Domain name for API request: ses.tencentcloudapi.com.
This API is used to send a TEXT or HTML email to multiple recipients at a time for marketing or notification purposes. By default, you can send emails using a template only. You need to create a recipient group with email addresses first and then send emails by group ID. SES supports scheduled and recurring email sending tasks. You need to pass in TimedParam
for a scheduled task and CycleParam
for a recurring one.
A maximum of 20 requests can be initiated per second for this API.
The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.
Parameter Name | Required | Type | Description |
---|---|---|---|
Action | Yes | String | Common Params. The value used for this API: BatchSendEmail. |
Version | Yes | String | Common Params. The value used for this API: 2020-10-02. |
Region | Yes | String | Common Params. For more information, please see the list of regions supported by the product. |
FromEmailAddress | Yes | String | Sender address. Enter a sender address such as noreply@mail.qcloud.com . To display the sender name, enter the address in the following format:sender <email address>. For example: Tencent Cloud team <noreply@mail.qcloud.com> |
ReceiverId | Yes | Integer | Recipient group ID |
Subject | Yes | String | Email subject |
TaskType | Yes | Integer | Task type. 1 : immediate; 2 : scheduled; 3 : recurring |
ReplyToAddresses | No | String | Reply-to address. You can enter a valid personal email address that can receive emails. If this parameter is left empty, reply emails will fail to be sent. |
Template | No | Template | Template when emails are sent using a template |
Simple | No | Simple | Disused |
Attachments.N | No | Array of Attachment | Attachment parameters to set when you need to send attachments. This parameter is currently unavailable. |
CycleParam | No | CycleEmailParam | Parameter required for a recurring sending task |
TimedParam | No | TimedEmailParam | Parameter required for a scheduled sending task |
Unsubscribe | No | String | Unsubscribe link option. 0 : Do not add unsubscribe link; 1 : English 2 : Simplified Chinese; 3 : Traditional Chinese; 4 : Spanish; 5 : French; 6 : German; 7 : Japanese; 8 : Korean; 9 : Arabic; 10 : Thai |
ADLocation | No | Integer | Whether to add an ad tag. 0 : Add no tag; 1 : Add before the subject; 2 : Add after the subject. |
Parameter Name | Type | Description |
---|---|---|
TaskId | Integer | Sending task ID |
RequestId | String | The unique request ID, which is returned for each request. RequestId is required for locating a problem. |
POST / HTTP/1.1
Host: ses.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: BatchSendEmail
<Common request parameters>
{
"Attachments": [
{
"Content": "Attachment content",
"FileName": "Filename"
}
],
"TimedParam": {
"BeginTime": "2021-09-10 11:10:11"
},
"FromEmailAddress": "abc@bbc.com",
"ReplyToAddresses": "abc@bbc.com",
"Simple": {
"Text": "text",
"Html": "html"
},
"ReceiverId": 123,
"Template": {
"TemplateData": "{\"name\":\"123\"}",
"TemplateID": 1
},
"CycleParam": {
"IntervalTime": 1,
"BeginTime": "2021-09-10 11:10:11"
},
"Subject": "Email subject",
"TaskType": 1,
"ADLocation": 0
}
{
"Response": {
"RequestId": "8979fc1e-9564-4fc9-bf7d-2958ce679b72",
"TaskId": 123
}
}
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.
The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.
Error Code | Description |
---|---|
FailedOperation.EmailContentToolarge | The email is too large. Remove some content. |
InternalError | Internal error. |
InvalidParameterValue.BeginTimeBeforeNow | The start time cannot be earlier than the current time. |
InvalidParameterValue.EmailContentIsWrong | Incorrect email content. Make sure TEXT/HTML base64 is correct. |
InvalidParameterValue.SubjectLengthError | The email subject must contain 1 to 100 characters. |
InvalidParameterValue.TemplateDataError | Template parameters must be in JSON format. |
InvalidParameterValue.TemplateNotMatchData | Template variables do not match recipient list parameters. |
MissingParameter.CycleParamNecessary | For a recurring sending task, you must select the start time and recurrence. |
MissingParameter.SendParamNecessary | Sender address, recipient group, and email template are required. |
MissingParameter.TimedParamNecessary | For a scheduled sending task, you must select the start time. |
OperationDenied.ReceiverNotExist | The recipient group does not exist. |
OperationDenied.ReceiverStatusError | The recipient group is empty or hasn’t been completely uploaded. |
OperationDenied.SendAddressStatusError | The sender address does not exist or hasn’t been approved. |
OperationDenied.TemplateStatusError | The email template does not exist or hasn’t been approved. |
Was this page helpful?