BatchSendMail

更新时间:
复制 MD 格式

Sends emails in batch.

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

*全部资源

*

None None

Request parameters

Parameter

Type

Required

Description

Example

TemplateName

string

No

The name of a pre-created and approved template.

test1

AccountName

string

Yes

The sender address configured in the management console.

test@example.com

ReceiversName

string

No

The name of a pre-created recipient list that has recipients uploaded.

Note

Note

Note

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

Note

Wait at least 10 minutes after triggering the task before deleting the recipient list. Otherwise, the email sending may fail.

test2

AddressType

integer

Yes

Valid values:

  • 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 of the reply-to address.

Jane

ClickTrace

string

No

Valid values:

  • 1: Enables data tracking.

  • 0 (default): Disables data tracking.

0

UnSubscribeLinkType

string

No

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

  • disabled: No unsubscribe link is generated.

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

The display language is automatically determined based on the recipient's browser settings.

default

UnSubscribeFilterLevel

string

No

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

  • disabled: No filtering is applied.

  • default: Uses the default policy. 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 restriction applies to API only. 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 sending.

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

DomainAuth

boolean

No

Specifies whether to enable domain-level authentication.

  • 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 replace the suffix with your own domain name.

API scenario

Set AccountName to the domain name. The recipient sees domain-auth-created-by-system@example.com as the sender.

SMTP scenario

a. Call the ModifyPWByDomain operation to set the domain password.

b. Authenticate with 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

TemplateContent

object

No

The custom email content. Directly specify the content without creating a template in advance. Use this parameter or TemplateName. If both TemplateContent and TemplateName are specified, TemplateName takes precedence.

Subject

string

No

The email subject.

黑色星期五,专属折扣来袭

HtmlBody

string

No

The HTML body of the email.

Note

Note: HtmlBody and TextBody are for different types of email content. You must specify at least one of them.

The new SDK uses Body for parameter passing with a limit of approximately 8 MB (Java 1.4.0 and later, Python3 1.4.0 and later, PHP 1.4.0 and later).

全场九折,仅限今日

TextBody

string

No

The plain text body of the email.

Note

Note: HtmlBody and TextBody are for different types of email content. You must specify at least one of them.

The new SDK uses Body for parameter passing with a limit of approximately 8 MB (Java 1.4.0 and later, Python3 1.4.0 and later, PHP 1.4.0 and later).

全场九折,仅限今日

Alias

string

No

The display name of the sender.

Jackie

Receivers

array<object>

No

The recipient list. The number of recipients must not exceed 100. Use this parameter or ReceiversName. If both Receivers and ReceiversName are specified, ReceiversName takes precedence.

Example: [{"To":["Jackie@example.com"],"TemplateData":{"UserName":"Jackie"}},{"To":["Tom@example.com"],"TemplateData":{"UserName":"Tom"}}].

array<object>

No

The details of a custom recipient.

To

array

No

The recipient list. This is an array type.

string

No

The email address.

Jackie@example.com

TemplateData

object

No

The email template parameters. This is a JSON map data type.

string

No

key-value 字符串

{"UserName": "Jackie"}

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.