Skip to main content

SendEmailTemplate

Before using this API, please prepare the following content in the console:

  • Create available templates.
  • Set up the custom domain name and verify that it passes.
  • Set sender information.

Request Parameters

Field NameParameter TypeDescribeRequire
ActionstringValue: SendEmailTemplateYes
AccountIdintProject ID. Get AccountId.Yes
TemplateIdstringID of the email template to be sentYes
SenderEmailstringThe email address that was configured in the console Sender Setting.Yes
EmailContent[]TargetEmailEmail receiving address.TargetEmail structure array with a length between 1 and 100.Yes
TargetEmail struct
Field NameParameter TypeDescribeRequire
EmailAddressstringemail receiving addressYes
TemplateVariableParams[]stringtemplate variable parameters. Strings are concatenated from variable names, {##}, and variable values. For example:name{##}Jane.No

Response Parameters

Field NameParameter TypeDescribeRequire
RetCodeintWhen RetCode is not 0, the specific error description is displayed in Message. If RetCode is 0, Message will not be returned.Yes
MessagestringReturn status code description. If the operation is successful, it will be returned as empty by default.Yes
SessionNostringThe unique ID of this sending task.you can query the list of emails sent according to the value.Note:the field is returned only when the number of successfully submitted emails is greater than 0.No
SuccessCountintThe number of successfully submitted emails.No
FailContent[]FailedTargetEmailDetails that were not sent successfully can be resent based on the field.No
FailedTargetEmail struct
Field NameParameter TypeDescribe
EmailAddressstringemail receiving address
TemplateVariableParams[]stringtemplate variable parameters
FailureReasonstringthe reason why submit failed.Note:if the template/domain/sender check failed, the field is empty.

Request Example

curl 'https://api.uspeedo.com/api' \
--header 'X-AccessToken: eyJxxxxxxxxx1RI' \
--header 'Content-Type: text/plain' \
--data-raw '{
"Action": "SendEmailTemplate",
"SendEmail": "example@example.com",
"TemplateId": "UETXXXXXXXXXXX",
"EmailContent": [
{
"EmailAddress": "example@example.com",
"TemplateVariableParams": [
"variable1{##}Params1",
"variable2{##}Params2"
]
}
]
}'

Response Example

{
"Action": "SendEmailTemplateResponse",
"FailContent": [
{
"EmailAddress": "example@example.com",
"TemplateVariableParams": [
"variable1{##}Params1",
"variable2{##}Params2"
],
"FailureReason": "reason"
}
],
"Message": "Success",
"RequestUuid": "bb7ee377-fa16-4df4-945a-0e624fc1316b",
"RetCode": 0,
"SessionNo": "6977469d-d6fc-47e1-ad46-67d866f80655",
"SuccessCount": 0
}