tencent cloud

Feedback

BatchSendEmail

Last updated: 2022-08-11 11:23:37

1. API Description

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. To send custom content, please contact your sales rep to enable this feature. 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.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

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, for example, noreply@mail.qcloud.com. To display the sender name, enter the address in the following format:
Sender , 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 be sent to Tencent Cloud.
Template No Template Template when emails are sent using a template
Simple No Simple Email content when emails are sent by calling the API. This parameter is currently unavailable.
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 option. 1: provides an unsubscribe link; 0: does not provide an unsubscribe link
ADLocation No Integer Whether to add an ad tag. 0: Add no tag; 1: Add before the subject; 2: Add after the subject.

3. Output Parameters

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.

4. Example

Example1 Adding a batch sending task

Input Example

POST / HTTP/1.1
Host: ses.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: BatchSendEmail
<Common request parameters>

{
    "Attachments": [
        {
            "Content": "Attachment content",
            "FileName": "File name"
        }
    ],
    "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
}

Output Example

{
  "Response": {
    "RequestId": "8979fc1e-9564-4fc9-bf7d-2958ce679b72",
    "TaskId": 123
  }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

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 Variables must be in JSON format.
InvalidParameterValue.TemplateNotMatchData
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.
Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

7x24 Phone Support