電子郵件

發送電子郵件

排隊等待交易電子郵件的送達。

POST/emails
1curl -X POST 'https://sendtern.com/emails' \
2  -H 'Authorization: Bearer st_your_api_key' \
3  -H 'Content-Type: application/json' \
4  -d '{
5  "from": "Acme <hello@mail.acme.io>",
6  "to": [
7    "ada@example.com"
8  ],
9  "subject": "Your sign-in code",
10  "html": "<p>482 913</p>",
11  "tags": [
12    {
13      "name": "category",
14      "value": "auth"
15    }
16  ]
17}'
回應
1{
2  "id": "47be30ca-24b7-48fb-b35d-ff287b89e66d"
3}

Accepts the email and returns HTTP 200 with its ID. Delivery happens asynchronously; follow it with Retrieve email. Send an Idempotency-Key header to retry safely.

身體參數

fromstring必須

發件人地址。使用 Name <address> 作為友好的名稱。域名必須被驗證。

tostring | string[]必須

收件人地址 , 或是最多50個數組。

subjectstring必須

電子郵件主題 , 最多500個字符。

htmlstring

HTML 主體。除非設定為 text,否則必須。

textstring

純文本主體。提供文本、HTML 或已發布的模板。

ccstring | string[]

複印收件人 , 數到50個收件人

bccstring | string[]

隱藏副本收件人數到50個收件人限制

reply_tostring | string[]

回應的去向

tagsobject[]

最多十個物件,包含名稱和值。

templateobject

已發布模板 ID 或別名和可選變數。

標題

Idempotency-Keystring

最多256個字符。請參閱 Idempotency keys。