送出例子
用cURL發送
直接從終端發送來測試你的設置。
前提條件
- 存儲為
SENDTERN_API_KEY的 Sendtern API 鍵 - A terminal with
curlinstalled (it ships with macOS, Linux and Windows 10+)
- 1
發送電子郵件
Run this in your terminal.
1curl -X POST https://sendtern.com/emails \ 2 -H "Authorization: Bearer $SENDTERN_API_KEY" \ 3 -H "Content-Type: application/json" \ 4 -d '{ 5 "from": "Acme <hello@mail.example.com>", 6 "to": ["you@example.com"], 7 "subject": "Hello from the terminal", 8 "html": "<p>It works!</p>" 9 }' - 2
檢查一下反應
成功的請求返回
200 OK與電子郵件 ID。使用它以後查看電子郵件。1{ 2 "id": "47be30ca-24b7-48fb-b35d-ff287b89e66d" 3}
用您的 verified domain 的地址替换示例发件人。