از اینجا شروع کنید

شروع سریع

یک کلید بسازید، یک دامنه را تأیید کنید و با یک درخواست امن برای تلاش مجدد، یک ایمیل کنترل‌شده ارسال کنید.

پیش از شروع

Create a SendHQ workspace and keep the dashboard open. You can verify a domain and create an API key before paying. Sending requires an active subscription: there is no free allowance, including to your own address. Choose a plan at pricing.

1. ساخت کلید API

در داشبورد بخش API keys را باز کنید، یک نام توصیفی مانند Production انتخاب کنید و کلید را هنگام نمایش کپی کنید. آن را در یک مدیر اسرار سمت سرور نگه دارید. SendHQ دیگر هرگز مقدار کامل آن را برنمی‌گرداند.

.env
SENDHQ_API_KEY=re_your_key_here

2. افزودن دامنه ارسال

Open Domains, add a domain you control, and publish the returned DKIM, SPF, DMARC, and domain verification records. Copy the records into your DNS host and click Verify. On Cloudflare, add them as DNS only (grey cloud). Add the records, then click Verify.

Do not publish a second SPF policy.If SPF already exists, merge SendHQ's SPF include (include:amazonses.com) into the existing v=spf1 value.

3. منتظر تأیید بمانید

Use the dashboard or POST /domains/:id/verify. DNS can move through pending, checking, and propagating before the sending identity is verified.

4. ارسال یک پیام کنترل‌شده

curl
curl https://sendhq.cc/api/v1/emails \
  -H "Authorization: Bearer $SENDHQ_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: onboarding-user-42" \
  -d '{"from":"Acme <hello@example.com>","to":["owner@example.com"],"subject":"SendHQ is connected","html":"<h1>It works</h1><p>Your first controlled message was accepted.</p>","text":"It works. Your first controlled message was accepted."}'

یک درخواست موفق شناسه ایمیل SendHQ، شناسه پیام ارائه‌دهنده و شناسه رشته گفتگو را برمی‌گرداند. شناسه SendHQ را همراه با رویداد برنامه‌ای که باعث ارسال ایمیل شده ذخیره کنید.

5. رسیدگی به نتایج

پذیرفته شدن درخواست API با تحویل به گیرنده یکی نیست. /emails/:id/events را دریافت کنید یا از داشبورد برای بررسی رویدادهای تحویل، برگشت ایمیل، گزارش اسپم، رد، باز شدن و کلیک استفاده کنید.