HTTP API
发送、批量发送、查询、取消。
curl -X POST http://localhost:3000/emails \
-H "Authorization: Bearer am_xxx" \
-H "Content-Type: application/json" \
-d '{
"provider_id": "smtp_provider_id",
"from": "示例 <hello@example.com>",
"to": "user@example.com",
"subject": "你好",
"text": "测试邮件"
}'import { Amail } from '@wydev/amail'
const amail = new Amail('am_xxx', {
baseUrl: 'http://localhost:3000',
providerId: 'smtp_provider_id',
})
await amail.emails.send({
from: 'hello@example.com',
to: 'user@example.com',
subject: '你好',
text: '测试邮件',
})