SendEmail

Last updated: 2021-02-02 11:44:43

1. API Description

Domain name for API request: ses.tencentcloudapi.com.

This API is used to send a TEXT or HTML email. By default, you can only send emails using a template. To send custom content, please contact your sales rep to enable this feature.

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 parameter. The value used for this API: SendEmail.
Version Yes String Common parameter. The value used for this API: 2020-10-02.
Region Yes String Common parameter. 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 <email address>. For example:
Tencent Cloud team <noreply@mail.qcloud.com>
Destination.N Yes Array of String Recipient email addresses. You can send an email to up to 50 recipients at a time. Note: the email content will display all recipient addresses. To send one-to-one emails to several recipients, please call the API multiple times to send the emails.
Subject Yes String Email subject.
ReplyToAddresses No String Reply-to address. You can enter a valid personal email address that can receive emails. If this field is left empty, reply emails will be sent to Tencent Cloud.
Template No Template Template when sending emails using a template.
Simple No Simple Email content when sending emails by calling the API.
Attachments.N No Array of Attachment Email attachments

3. Output Parameters

Parameter Name Type Description
MessageId String Unique ID generated when receiving the message
RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Example

Example1 Sending a plain text email

Input Example

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

{"FromEmailAddress":"QCLOUDTEAM <noreply@mail.qcloud.com>","ReplyToAddresses":"qcloud@tencent.com","Destination":["user@example.com"],"Simple":{"Text":"aGVsbG8gd29ybGQ="},"Subject":"YourTestSubject"}

Output Example

{
  "Response": {
    "RequestId": "8979fc1e-9564-4fc9-bf7d-2958ce679b72",
    "MessageId": "qcloud-ses-messageid"
  }
}

Example2 Sending a rich text email

Input Example

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

{
  "FromEmailAddress": "QCLOUDTEAM <noreply@mail.qcloud.com>",
  "ReplyToAddresses": "qcloud@tencent.com",
  "Destination": [
    "user@example.com"
  ],
  "Simple": {
    "Html": "PGh0bWw+PGRpdj5IZWxsb1dvcmxkPC9kaXY+PC9odG1sPg==",
    "Text": "aGVsbG8gd29ybGQ="
  },
  "Subject": "YourTestSubject"
}

Output Example

{
  "Response": {
    "RequestId": "8979fc1e-9564-4fc9-bf7d-2958ce679b72",
    "MessageId": "qcloud-ses-messageid"
  }
}

Example3 Sending a template email

Input Example

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

{"FromEmailAddress":"QCLOUDTEAM <noreply@mail.qcloud.com>","ReplyToAddresses":"qcloud@tencent.com","Destination":["user@example.com"],"Template":{"TemplateID":"100091","TemplateData":"{\"code\":\"1234\"}"},"Subject": "YourTestSubject"}

Output Example

{
  "Response": {
    "RequestId": "8979fc1e-9564-4fc9-bf7d-2958ce679b72",
    "MessageId": "qcloud-ses-messageid"
  }
}

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.AttachContentToolarge The attachments are too large. Make sure they do not exceed the size limit for a single attachment and the overall limit for all attachments.
FailedOperation.EmailAddrInBlacklist The email address is in the blocklist.
FailedOperation.EmailContentToolarge The email is too large. Remove some content.
FailedOperation.ExceedSendLimit The number of emails exceeds the daily sending limit.
FailedOperation.FrequencyLimit You have sent too many emails to the same address in a short period.
FailedOperation.HighRejectionRate The email has been blocked temporarily due to high rejection rate.
FailedOperation.IncorrectEmail Incorrect email address.
FailedOperation.InsufficientBalance Insufficient balance or account in arrears.
FailedOperation.InsufficientQuota Insufficient emails in plans.
FailedOperation.InvalidAttachName Unsupported attachment name. Make sure it does not contain special characters. For details, see the attachment description.
FailedOperation.InvalidTemplateID Invalid template ID or unavailable template.
FailedOperation.MissingEmailContent
FailedOperation.NoAttachPermission No permission to send an email with attachments.
FailedOperation.NotAuthenticatedSender Unable to send because the sender is not verified.
FailedOperation.ProtocolCheckErr Incorrect protocol. Make sure the protocol is correct.
FailedOperation.TemporaryBlocked The email has been blocked temporarily due to violations of rules.
FailedOperation.TooManyAttachments Too many attachments. A single email supports up to 10 attachments.
FailedOperation.TooManyRecipients Too many recipients. Set a maximum of 50 recipients at a time.
FailedOperation.UnsupportMailType Unsupported email type.
FailedOperation.WithOutPermission The feature of sending custom emails is not enabled. Use a template to send emails.
FailedOperation.WrongContentJson The format of the TemplateData field is incorrect. Make sure it is in JSON format.
InternalError Internal error.
InvalidParameter Incorrect parameter.
InvalidParameterValue Invalid parameter value.
InvalidParameterValue.AttachContentIsWrong Incorrect attachment content. Make sure the base64 content is correct.
InvalidParameterValue.EmailAddressIsNULL The recipient or sender address is empty. Please check.
InvalidParameterValue.EmailContentIsWrong Incorrect email content. Make sure TEXT/HTML base64 is correct.
LimitExceeded The quota limit is exceeded.
MissingParameter Missing parameter.
OperationDenied Operation denied.
RequestLimitExceeded The number of requests exceeds the frequency limit.
ResourceInsufficient Insufficient resources.
ResourceUnavailable The resource is unavailable.
UnknownParameter Unknown parameter error.
UnsupportedOperation Unsupported operation.

Was this page helpful?

Was this page helpful?

  • Not at all
  • Not very helpful
  • Somewhat helpful
  • Very helpful
  • Extremely helpful
Send Feedback
Help