SingleSendMail
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 console. |
test***@example.net |
| AddressType |
integer |
Yes |
The address type. Valid values:
|
1 |
| TagName |
string |
No |
The tag created in the Direct Mail console to classify sent email batches. You can use tags to query the sending status of each email batch. If the email tracking feature is enabled, a tag is required for sending emails. The tag must be 1 to 128 characters in length and can contain letters, digits, underscores (_), and hyphens (-). |
test |
| ReplyToAddress |
boolean |
Yes |
Specifies whether to enable the reply-to address configured in the console. The reply-to address must be verified. Valid values: true and false. |
true |
| ToAddress |
string |
Yes |
The recipient addresses. You can specify up to 100 email addresses, including email groups. Separate multiple email addresses with commas (,). |
test1***@example.net |
| Subject |
string |
Yes |
The subject of the email. The subject can be up to 256 characters in length. |
Subject |
| HtmlBody |
string |
No |
The HTML body of the email. Note: You must specify either HtmlBody or TextBody based on the email content type.
|
body |
| TextBody |
string |
No |
The text body of the email. Note: You must specify either HtmlBody or TextBody based on the email content type.
|
body |
| FromAlias |
string |
No |
The sender alias. The alias must be less than 15 characters in length. Example: If the sender alias 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 alias of the reply-to address. |
Jane |
| ClickTrace |
string |
No |
Specifies whether to enable the data tracking feature. Valid values:
|
0 |
| UnSubscribeLinkType |
string |
No |
The unsubscribe link type. Valid values:
|
default |
| UnSubscribeFilterLevel |
string |
No |
The filtering level. For more information, see 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 standard syntax requirements for headers. When sending emails through the API, you can pass up to 10 headers by using the headers field. Headers that exceed the limit are ignored. SMTP has no such limit.
Message-ID, List-Unsubscribe, and List-Unsubscribe-Post. Standard fields overwrite the original values in the email headers.
Non-standard fields are case-insensitive. a. Fields that start with X-User-: These fields are not pushed to EventBridge (EB) or Message Service (MNS). This is an API-only requirement. SMTP allows any custom fields. b. Fields that start with X-User-Notify-: These fields are pushed to EB and MNS. Both API and SMTP support these fields. When pushed to EB or MNS, the header field includes these fields. |
{
"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 the current email sending task. For more information, see Dedicated IP addresses. |
e4xxxxxe-4xx0-4xx3-8xxa-74cxxxxx1cef |
| Attachments |
array<object> |
No |
This parameter is supported only in the latest SDKs. OpenAPI and signature mechanisms do not support this parameter. For more information, see How do I send emails with attachments by using SDKs?. |
|
|
object |
No |
This parameter is supported only in the latest SDKs. OpenAPI and signature mechanisms do not support this parameter. |
||
| AttachmentName |
string |
No |
This parameter is supported only in the latest SDKs. OpenAPI and signature mechanisms do not support this parameter. |
test.txt |
| AttachmentUrl |
string |
No |
This parameter is supported only in the latest SDKs. OpenAPI and signature mechanisms do not support this parameter. |
C:\Users\Downloads\test.txt |
| Template |
object |
No |
The template information for sending emails by using a template. When a template is used, the values of Subject, HtmlBody, and TextBody are ignored. |
|
| TemplateId |
string |
No |
The template ID. |
123456 |
| TemplateData |
object |
No |
The template variables and their values. |
{"name":"Tom","age":"22"} |
|
string |
No |
The template variable parameters and their values. |
{ "name": "Tom", "age": "22" } |
|
| BccAddress |
string |
No |
Note: The SingleSendMail operation does not support the CC field. To use the CC feature, send emails by using SMTP. |
1@example.com,2@example.com |
| DomainAuth |
boolean |
No |
Specifies whether to enable domain-level authentication. Valid values:
This parameter is used only for domain-level authentication. Ignore this parameter for sender address-level authentication.
API scenario Set AccountName to the custom sender address of the domain. The recipient sees the custom sender address as the sender. SMTP scenario a. Call the ModifyPWByDomain operation to set the domain password. b. Authenticate by using the domain name and the configured password. Set the actual sender mailfrom to a custom address, such as user@example.com. 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.