邮件消息
Email Message 是通过 AM 邮件基础设施发送或接收的邮件记录。
Schema
interface EmailMessage {
id: string; // "eml_..." - Unique identifier
account_id: string; // Owning account
hostname: string; // Sending domain
direction: "in" | "out"; // Inbound or outbound
from_contact: EmailContact;
reply_to_contacts: EmailContact[];
to_contacts: EmailContact[];
cc_contacts: EmailContact[];
bcc_contacts: EmailContact[];
subject: string;
body_text: string;
body_html: string;
received_at: string | null;
sent_at: string | null;
}
interface EmailContact {
email: string;
name?: string;
}
属性
| 属性 | 类型 | 说明 |
|---|---|---|
id |
string |
带 eml_ 前缀的 KSUID |
account_id |
string |
拥有该消息的账户 |
hostname |
string |
发送所用域名 |
direction |
enum |
in 为接收,out 为发送 |
from_contact |
object |
发件人信息 |
reply_to_contacts |
array |
回复地址联系人 |
to_contacts |
array |
主收件人 |
cc_contacts |
array |
抄送收件人 |
bcc_contacts |
array |
密送收件人 |
subject |
string |
邮件主题 |
body_text |
string |
纯文本内容 |
body_html |
string |
HTML 内容 |
received_at |
string? |
入站邮件接收时间 |
sent_at |
string? |
出站邮件发送时间 |
示例
{
"id": "eml_2kHfPZcN9xW4mE8RtY7vB",
"account_id": "acc_1jGePYbM8wV3lD7QsX6uA",
"hostname": "mail.example.com",
"direction": "out",
"from_contact": {
"email": "noreply@example.com",
"name": "Acme Corp"
},
"reply_to_contacts": [],
"to_contacts": [{ "email": "user@example.com", "name": "Jane Doe" }],
"cc_contacts": [],
"bcc_contacts": [],
"subject": "Welcome to Acme",
"body_text": "Welcome...",
"body_html": "<h1>Welcome</h1>...",
"sent_at": "2025-01-15T10:30:00Z"
}
相关
- Email Message Event - 投递追踪
- Email Template - 可复用模板
- 邮件 - 邮件基础设施