Sends a single email.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
dm:SingleSendMail |
none |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| AccountName |
string |
Yes |
The sender address configured in the management console. |
test***@example.net |
| AddressType |
integer |
Yes |
The address type. Valid values:
|
1 |
| TagName |
string |
No |
The tag created in the DirectMail console. Tags are used to categorize email batches. You can query the sending status of each batch by tag. If the email tracking feature is enabled, you must use an email tag when sending emails. The value must be 1 to 128 characters in length and can contain letters, digits, underscores (_), and hyphens (-). |
test |
| ReplyToAddress |
boolean |
Yes |
Specifies whether to use the reply-to address configured in the management console (the address must be verified). Valid values: true or false. |
true |
| ToAddress |
string |
Yes |
The destination address. You can specify multiple email addresses separated by commas. A maximum of 100 addresses are supported (mailing lists are supported). |
test1***@example.net |
| Subject |
string |
Yes |
The email subject. The value cannot exceed 256 characters in length. |
Subject |
| HtmlBody |
string |
No |
The HTML body of the email. Note: HtmlBody and TextBody are used for different types of email content. You must specify one of them.
|
body |
| TextBody |
string |
No |
The text body of the email. Note: HtmlBody and TextBody are used for different types of email content. You must specify one of them.
|
body |
| FromAlias |
string |
No |
The sender nickname. The value cannot exceed 15 characters in length. For example, if the sender nickname is set to "Jane" and the sender address is test***@example.net, the recipient sees the sender address as "Jane" test***@example.net. |
Jane |
| ReplyAddress |
string |
No |
The reply-to address. |
test2***@example.net |
| ReplyAddressAlias |
string |
No |
The reply-to address nickname. |
Jane |
| ClickTrace |
string |
No |
Specifies whether to enable data tracking. Valid values:
|
0 |
| UnSubscribeLinkType |
string |
No |
The type of unsubscribe link. Valid values:
The display language is automatically detected based on the recipient's browser settings. |
default |
| UnSubscribeFilterLevel |
string |
No |
The filtering level. For more information, refer to Unsubscribe link generation and filtering mechanism. Valid values:
|
mailfrom_domain |
| Headers |
string |
No |
The email header settings. Both standard and non-standard fields must comply with the syntax requirements for headers defined in the standard. A maximum of 10 headers can be passed through the headers field when sending emails via API. Headers exceeding this limit are ignored. SMTP has no such limit.
Message-ID, List-Unsubscribe, List-Unsubscribe-Post Standard fields overwrite the original values in the email header.
Case-insensitive. a. Fields prefixed with X-User- (not pushed to EventBridge or Message Service MNS. This is an API-only requirement. SMTP allows any custom fields.) b. Fields prefixed with X-User-Notify- (pushed to EventBridge and Message Service MNS. Both API and SMTP are supported.) When pushed to EventBridge or MNS, these fields are included under the header field. |
{
"Message-ID": " |
| IpPoolId |
string |
No |
The ID of the dedicated IP address pool. Users who have purchased dedicated IP addresses can use this parameter to specify the outbound IP address for this email. For more information, refer to Dedicated IP. |
e4xxxxxe-4xx0-4xx3-8xxa-74cxxxxx1cef |
| Attachments |
array<object> |
No |
Supported only when using the new SDK. Not supported through OpenAPI or signature mechanism methods. For more information, refer to How do I send emails with attachments through the SDK?. |
|
|
object |
No |
Supported only when using the new SDK. Not supported through OpenAPI or signature mechanism methods. |
||
| AttachmentName |
string |
No |
Supported only when using the new SDK. Not supported through OpenAPI or signature mechanism methods. |
test.txt |
| AttachmentUrl |
string |
No |
Supported only when using the new SDK. Not supported through OpenAPI or signature mechanism methods. |
C:\Users\Downloads\test.txt |
| Template |
object |
No |
The template information for template-based sending. When sending with a template, the HtmlBody and TextBody values are ignored. |
|
| TemplateId |
string |
No |
The template ID. |
xxx |
| TemplateData |
object |
No |
The template variables and values. |
|
|
string |
No |
The template variable parameter and value. |
{ "name": "Tom", "age": "22" } |
|
| BccAddress |
string |
No |
Note: The SingleSendMail operation does not support the Cc (carbon copy) field. Use SMTP if you need this feature. |
1@example.com,2@example.com |
| DomainAuth |
boolean |
No |
Specifies whether to enable domain-level authentication. Valid values:
Use this parameter only for domain-level authentication. Ignore it for sender address-level authentication.
API scenario Set AccountName to a custom sender address for the domain. The recipient sees the custom sender address as the sender. SMTP scenario a. Set the domain password through the ModifyPWByDomain operation. b. Authenticate using the domain name and the configured password. Pass a custom address such as user@example.com as the actual sender (mailfrom). The recipient sees user@example.com as the sender. |
true |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| EnvId |
string |
The event ID. |
600000xxxxxxxxxx642 |
| RequestId |
string |
The request ID. |
2D086F6-xxxx-xxxx-xxxx-006DED011A85 |
Examples
Success response
JSON format
{
"EnvId": "600000xxxxxxxxxx642",
"RequestId": "2D086F6-xxxx-xxxx-xxxx-006DED011A85"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | InvalidReceiverName.Malformed | The format of the receiver name is invalid. It must contain the @ sign. The domain must only contain numbers, letters, underscores, minus signs, and periods. The account name must only contain numbers, letters, underscores, minus signs, and periods. | The format of the receiver name is invalid. It must contain the @ sign. The domain must only contain numbers, letters, underscores, minus signs, and periods. The account name must only contain numbers, letters, underscores, minus signs, and periods. |
| 404 | InvalidMailAddress.NotFound | The specified mail address is not found. | The specified mail address is not found. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.