Email Message
Email Message คือระเบียนของอีเมลที่ส่งหรือรับผ่านโครงสร้างพื้นฐานอีเมลของ AM
สคีมา
interface EmailMessage {
id: string; // "eml_..." - ตัวระบุที่ไม่ซ้ำ
account_id: string; // บัญชีเจ้าของ
hostname: string; // โดเมนที่ใช้ส่ง
direction: "in" | "out"; // ขาเข้า หรือขาออก
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;
}
คุณสมบัติ
| Property | Type | คำอธิบาย |
|---|---|---|
id | string | KSUID ที่ขึ้นต้นด้วย eml_ |
account_id | string | บัญชีที่เป็นเจ้าของข้อความ |
hostname | string | โดเมนที่ใช้ส่ง |
direction | enum | in สำหรับรับเข้า, out สำหรับส่งออก |
from_contact | object | ข้อมูลผู้ส่ง |
reply_to_contacts | array | รายชื่อผู้รับสำหรับตอบกลับ |
to_contacts | array | ผู้รับหลัก |
cc_contacts | array | ผู้รับสำเนา (CC) |
bcc_contacts | array | ผู้รับสำเนาลับ (BCC) |
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 - เทมเพลตที่ใช้ซ้ำ
- Email - โครงสร้างพื้นฐานอีเมล