All Products
Search
Document Center

Direct Mail:BatchSendMail

Last Updated:Feb 05, 2026

Sends a batch of emails.

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:BatchSendMail

none

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

TemplateName

string

Yes

The name of a pre-created and approved template.

test1

AccountName

string

Yes

The sender address configured in the console.

test@example.com

ReceiversName

string

Yes

The name of a pre-created recipient list to which recipients have been uploaded.

Note:

The number of recipients in the list must not exceed your remaining daily quota. Otherwise, email sending fails.

Do not delete the recipient list for at least 10 minutes after triggering the task. Otherwise, email sending may fail.

test2

AddressType

integer

Yes

  • 0: Random account

  • 1: Sender address

1

TagName

string

No

The name of the email tag.

test3

ReplyAddress

string

No

The reply-to address.

test2***@example.net

ReplyAddressAlias

string

No

The alias for the reply-to address.

小红

ClickTrace

string

No

  • 1: Enables the data tracking feature.

  • 0 (default): Disables the data tracking feature.

0

UnSubscribeLinkType

string

No

The type of unsubscribe link to generate. For more information, see Unsubscribe link generation and filtering mechanism.

  • disabled: Does not generate a link.

  • default: Uses the default policy. An unsubscribe link is generated when batch emails are sent from a sender address to specific domains, such as those containing the keywords "gmail", "yahoo", "google", "aol.com", "hotmail", "outlook", or "ymail.com".

The language of the unsubscribe link matches the recipient's browser language setting.

default

UnSubscribeFilterLevel

string

No

The filtering level. For more information, see Unsubscribe link generation and filtering mechanism.

  • disabled: No filtering.

  • default: Uses the default policy. Batch emails are filtered at the sender address level.

  • mailfrom: Filters at the sender address level.

  • mailfrom_domain: Filters at the email domain level.

  • edm_id: Filters at the account level.

mailfrom_domain

Headers

string

No

Message header settings.

All fields, standard or non-standard, must follow standard header syntax. For API calls, the `headers` field supports up to 10 headers. Any headers beyond this limit are ignored. SMTP does not have a header limit.

1. Standard fields

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

Standard fields overwrite existing values in the message header.

2. Non-standard fields

Case-insensitive

a. Start with `X-User-`. These fields are not pushed to EventBridge or Message Service. They are required only for API calls. SMTP supports any custom header.

b. Start with `X-User-Notify-`. These fields are pushed to EventBridge and Message Service. They are supported by both API and SMTP.

When pushed to EventBridge or Message Service, these fields appear under the `headers` object.

{ "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. If you purchased dedicated IP addresses, use this parameter to specify the egress IP address for sending the email.

e4xxxxxe-4xx0-4xx3-8xxa-74cxxxxx1cef

DomainAuth

boolean

No

Enables domain-level authentication.

  • true

  • false

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

1. The console creates the address `domain-auth-created-by-system@example.com`. Do not change the prefix before the at sign (@). Replace the domain suffix with your own domain.

2.

API scenario

Set `AccountName` to your domain. Recipients see `domain-auth-created-by-system@example.com` as the sender.

SMTP scenario

a. Use the `ModifyPWByDomain` API to set a password for your domain.

b. Authenticate using your domain and the password. Set the actual sender address (`mailfrom`) to a custom address, such as `user@example.com`. Recipients see `user@example.com` as the sender.

true

Response elements

Element

Type

Description

Example

object

EnvId

string

The event ID.

xxx

RequestId

string

The request ID.

12D086F6-8F31-4658-84C1-006DED011A85

Examples

Success response

JSON format

{
  "EnvId": "xxx",
  "RequestId": "12D086F6-8F31-4658-84C1-006DED011A85"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.