/communication/email
向指定邮箱地址发送邮件。支持模板(需预定义模板)或直接发送HTML/纯文本内容,支持CC抄送和BCC密送,自动记录到发送日志。参考:ePrivacy Directive 2002/58/EC、CAN-SPAM Act。
Request Body
Schema: dto.EmailRequest
| Field | Type | Required | Example | Constraints | Description |
|---|---|---|---|---|---|
subject |
string |
Yes | 账户激活邮件 |
主题 | |
to |
array of string |
Yes | ['user@example.com'] |
items: 1–None | 收件人 |
bcc |
array of string |
No | ['manager@example.com'] |
密送 | |
cancel_key |
string |
No | order-123 |
||
cc |
array of string |
No | ['admin@example.com'] |
抄送 | |
content |
string |
No | <h1>欢迎!</h1> |
内容 | |
is_html |
boolean |
No | False |
HTML格式 | |
send_at |
string |
No | 2026-06-07T10:00:00Z |
||
template |
string |
No | welcome_email |
模板 | |
user_id |
string |
No | usr_abc123 |
用户ID | |
variables |
object |
No | extra keys: `string` | 变量 |
Responses
| Status | Description | Schema |
|---|---|---|
| 200 | 发送成功,返回发送日志详情 | dto.CommunicationLogDetailResponse |
| 400 | 请求参数错误 | dto.SimpleResponse |
| 401 | 未认证或令牌无效 | dto.SimpleResponse |
| 403 | 无权访问该资源 | dto.SimpleResponse |
| 404 | 资源不存在 | dto.SimpleResponse |
| 500 | 服务内部错误 | dto.SimpleResponse |
Referenced Schemas
dto.CommunicationLogDetailResponse
| Field | Type | Required | Example | Constraints | Description |
|---|---|---|---|---|---|
code |
integer |
No | |||
data |
dto.CommunicationLogResponse |
No | |||
message |
string |
No | |||
timestamp |
string |
No |
dto.CommunicationLogResponse
消息发送日志记录
| Field | Type | Required | Example | Constraints | Description |
|---|---|---|---|---|---|
channel |
string |
No | sms |
||
content |
string |
No | 您的验证码是123456 |
||
created_at |
string |
No | 2026-04-15T10:00:00Z |
||
error |
string |
No | 发送超时 |
||
id |
string |
No | log_abc123 |
||
provider |
string |
No | aliyun |
||
recipient |
string |
No | 138****8000 |
||
response |
string |
No | |||
sent_at |
string |
No | 2026-04-15T10:01:00Z |
||
status |
string |
No | delivered |
||
template_id |
string |
No | tpl_abc123 |
||
tenant_id |
string |
No | tnt_xyz789 |
||
updated_at |
string |
No | 2026-04-15T10:00:00Z |
||
user_id |
string |
No | usr_abc123 |
dto.SimpleResponse
| Field | Type | Required | Example | Constraints | Description |
|---|---|---|---|---|---|
code |
integer |
No | |||
message |
string |
No | |||
timestamp |
string |
No |