This topic describes how to call the SingleSendMail operation to send a single email. The SingleSendMail operation does not support sending attachments.
Debug
Request parameters
Name | Type | Required | Example | Description |
AccountName | String | Yes | test***@example.net | The sender address that you configure in the Direct Mail console. |
AddressType | Integer | Yes | 1 | The type of the sender address. Valid values:
|
ReplyToAddress | String | Yes | true | Specifies whether to use the reply-to address that you configure in the console. The status of the reply-to address must be verified. Valid values are the strings "true" and "false", not Boolean values. |
Subject | String | Yes | Subject | The email subject. The subject cannot exceed 100 characters in length. |
ToAddress | String | Yes | test1***@example.net | The recipient address. You can specify multiple recipient addresses. Separate them with commas (,). You can specify up to 100 recipient addresses. Account groups are supported. |
Action | String | No | SingleSendMail | The required parameter. Set the value to SingleSendMail. |
ClickTrace | String | No | 0 |
|
FromAlias | String | No | Xiao Hong | The sender alias. The alias can be up to 15 characters in length. For example, if you set the sender alias to "Alice" and the sender address to test***@example.net, the recipient sees "Alice" <test***@example.net>. |
HtmlBody | String | No | body | The HTML body of the email. The size is limited to 80 KB by the software development kit (SDK). Note: HtmlBody and TextBody specify the content of the email. You must specify one of them. |
TagName | String | No | test | The tag that you create in the Direct Mail console. You can use tags to classify email batches and query the sending status of each batch. If you enable email tracking, you must use an email tag. |
TextBody | String | No | body | The text body of the email. The size is limited to 80 KB by the SDK. Note: HtmlBody and TextBody specify the content of the email. You must specify one of them. |
ReplyAddress | String | No | test2***@example.net | The reply-to address. |
ReplyAddressAlias | String | No | Xiaohong | The alias for the reply-to address. |
UnSubscribeLinkType | String | No | default | The type of unsubscribe link to generate. For more information, see Unsubscribe feature.
"google", "aol.com", "hotmail", "outlook", "ymail.com", and so on
|
UnSubscribeFilterLevel | String | No | mailfrom_domain | The filtering level. For more information, see Unsubscribe feature.
|
Response parameters
Name | Type | Example | Description |
EnvId | String | xxxxxx | The event ID. |
RequestId | String | 2D086F6-8F31-4658-84C1-006DED011A85 | The request ID. |
Examples
Request example
https://dm.aliyuncs.com/?Action=SingleSendMail&AccountName=test***@example.net&AddressType=1&ReplyToAddress=true&Subject=Subject&ToAddress=test1***@example.net&<Common request parameters>Response examples
XML format
<SingleSendMailResponse> <EnvId>xxxxxx</EnvId> <RequestId>12D086F6-8F31-4658-84C1-006DED011A85</RequestId></SingleSendMailResponse>JSON format
{ "EnvId":"xxxxxx", "RequestId":"12D086F6-8F31-4658-84C1-006DED011A85"}Error codes
HTTP status code | Error code | Error message | Description |
400 | InvalidReceiverName.Malformed | The specified receiver name is wrongly formed. | The recipient address is in an invalid format. The address must contain an at sign (@). The account name and domain name can contain only letters, digits, underscores (_), hyphens (-), and periods (.). |
404 | InvalidMailAddress.NotFound | The specified mail address is not found. | The sender address is not found. |
404 | InvalidReceiver.NotFound | The specified receiver is invalid. | The recipient does not exist. Check if the recipient address is valid. |
400 | InvalidToAddress | The specified toAddress is wrongly formed. | The recipient address is in an invalid format. The address must contain an at sign (@). The account name and domain name can contain only letters, digits, underscores (_), hyphens (-), and periods (.). |
400 | InvalidToAddress.Spam | Sendmail rejected by invalid address. | The address is invalid. Check the validity of the address. |
400 | InvalidBody | The specified textBody or htmlBody is wrongly formed. | The format of TextBody or HtmlBody is invalid. Specify the content again. |
400 | InvalidSendMail.Spam | Sendmail rejected by spam filter. | The email failed to be sent. Check the user status for issues such as an exceeded frequency limit or insufficient quota. |
400 | InvalidMailAddressSendType.Malformed | The specified mailAddress sendType is wrongly formed. | The sending type is invalid. Go to the console to check the type and set the value accordingly. |
400 | InvalidMailAddressStatus.Malformed | The specified mailAddress status is wrongly formed. | The status of the sender address is invalid. Check if the address is active or frozen. |
400 | InvalidMailAddressDomain.Malformed | The specified mailAddress domain does not exist. | The domain name is in an invalid format. It can contain only letters, digits, underscores (_), hyphens (-), and periods (.). |
400 | InvalidSubject.Malformed | The specified subject is invalid. It must not exceed 100 characters. | The subject is invalid. It cannot exceed 100 characters in length. |
400 | InvalidFromAlias.Malformed | The specified fromAlias is wrongly formed. | The sender alias is in an invalid format. It cannot exceed 15 characters in length. |
400 | InvalidReplyAddressAlias.Malformed | The specified replyAddressAlias is wrongly formed. | The alias for the reply-to address is in an invalid format. It cannot exceed 15 characters in length. |
400 | InvalidReplyAddress.Malformed | The specified replyAddress is wrongly formed. | The reply-to address is in an invalid format. The address must contain an at sign (@). The account name and domain name can contain only letters, digits, underscores (_), hyphens (-), and periods (.). |
404 | InvalidIP.NotFound | The specified IP address is invalid. | The specified IP address is invalid. If you have enabled IP protection, make sure the IP address is in the list. |
400 | InvalidFromALias.Malformed | The specified fromAlias is wrongly formed. | The sender alias is invalid. Check the sender alias. It must be less than 15 characters in length. |
For more information about error codes, see Error Center.