All Products
Search
Document Center

Direct Mail:SingleSendMail

Last Updated:Aug 18, 2026

Sends a single email.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

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:

  • 0: random account

  • 1: sender address

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.

  • The size limit for URL-based parameter passing is approximately 80 KB.

  • The size limit for Body-based parameter passing with the new SDK is approximately 8 MB (Java 1.4.0 or later, Python3 1.4.0 or later, PHP 1.4.0 or later).

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.

  • The size limit for URL-based parameter passing is approximately 80 KB.

  • The size limit for Body-based parameter passing with the new SDK is approximately 8 MB (Java 1.4.0 or later, Python3 1.4.0 or later, PHP 1.4.0 or later).

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:

  • 1: Enable data tracking.

  • 0 (default): Disable data tracking.

0

UnSubscribeLinkType

string

No

The type of unsubscribe link. Valid values:

  • disabled: No unsubscribe link is generated.

  • default: The default policy is used. An unsubscribe link is generated when emails are sent from batch-type sender addresses to specific domains, such as those containing keywords "gmail", "yahoo", "google", "aol.com", "hotmail", "outlook", or "ymail.com". For more information, refer to Unsubscribe link generation and filtering mechanism.

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:

  • disabled: No filtering is applied.

  • default: The default policy is used. Batch addresses use sender address-level filtering.

  • mailfrom: Sender address-level filtering.

  • mailfrom_domain: Sender domain-level filtering.

  • edm_id: Account-level filtering.

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.

  1. Standard fields

Message-ID, List-Unsubscribe, List-Unsubscribe-Post

Standard fields overwrite the original values in the email header.

  1. Non-standard fields

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": "", "X-User-UID1": "UID-1-000001", "X-User-UID2": "UID-2-000001", "X-User-Notify-UID1": "UID-3-000001", "X-User-Notify-UID2": "UID-4-000001" }

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

  • Specifies the BCC (blind carbon copy) recipient list for the email.

  • The system sends a copy identical to the main email content to each BCC address. The BCC information is not visible to any recipients (including ToAddress and BccAddress).

  • To protect the privacy of BCC recipients, email tracking features are disabled by default for BCC emails. This means the system does not record behavioral data such as open rates or click-through rates for BCC emails. However, billing for sending volume, sending details, and sending status statistics remain consistent with regular emails.

  • A maximum of 2 BCC recipients can be specified per send.

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:

  • true

  • false

Use this parameter only for domain-level authentication. Ignore it for sender address-level authentication.

  1. Create the address domain-auth-created-by-system@example.com in the console. Keep the prefix before @ unchanged and use your own domain name as the suffix.

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.