Send Mail Template


Send email messages based on the email template, specify the values for the parameters in the email template.

After the request is successful, the SMS send request will be placed in a message queue, and the API will return an eventId, which can be used to check the actual sending result via the Search Send Result API.

Request Format


POST https://{apigw-address}/notification-center-service/v2.0/template/email

Request Parameters (URI)


Name

Location (Path/Query)

Required/Optional

Data Type

Description

orgId

Quary

Required

String

The organization ID. How to get the orgId>>

Request Parameters (Body)


Name

Required/Optional

Data Type

Description

variables

Required

Map<String, String>

The variables that need to be used in the mail template. You can go to EnOS Application Portal > Developer Console, select Notification Management > Message Management > Templates, and view the variables in the Mail tab page.

templateCode

Required

String

Template identifier.

toAddresses

Required

List<String>

A list of email addresses for recipients.

ccAddresses

Optional

List<String>

A list of cc mailbox addresses.

senderCode

Required

String

The outgoing box identifier is used to configure which mailbox to send this email through. You can go to EnOS Application Portal > Developer Console, select Notification Management > Message Management > Configurations, and view the sender ID in the Mail tab page. If this parameter is empty, it will be sent via the default mail channel, which is different according to the OU configurations.

priority

Optional

Enum

Message sending priority, supporting P0, P1, and P2. Default is P2, and no special configuration required.

extras

Optional

/

This is only required when you need to add a custom multi-line table in the email content (when the email template variable contains the SYS_TABLE variable). The value of extras will replace the value of the SYS_TABLE variable. You can refer to the Request Example for an example.

Response Parameters


Name

Required/Optional

Data Type

Description

eventId

Required

String

You can use event ID to search the actual result after the message push request is sent.

Error Codes


Code

Data Type

Description

32404

email address is not exist in this organization

There is no sender email message.

32404

email template is not exist

The mail template does not exist.

32400

variable not in template

Error customizing variable in template.

32400

the format of mail address is illegal

The recipient’s mailbox (cc mailbox) address format is incorrect.

32535

fail to authenticate the smtp server

SMTP server authentication failed.

Samples

Request Sample


url: https://{apigw-address}/notification-center-service/v2.0/template/email?orgId=yourOrgId
method: POST
requestBody:
{
  "variables": {},
  "ccAddresses": [],
  "templateCode": "",
  "priority": "P2",
  "toAddresses": [
    "xxx@univers.com"
  ],
  "senderCode":"",
  "extras":{
     "table":{
        "header": ["comuln_1","comuln_2", ... "comuln_n" ],
        "rows": [["comuln_1","comuln_2", ... "comuln_n" ], ["comuln_1","comuln_2", ... "comuln_n" ], ... ["comuln_1","comuln_2", ... "comuln_n" ]]
     }
  }
}

Return Sample


{"code":0, "msg":"OK", "submsg":"", "requestId": null, "data":{"eventId": "evt16062008765401}}

Abnormal Sample


{"code":32403, "msg":"the quota is run out, test quota is limited", "submsg":"Permission denied: tunnel.quota.run.out", "data": null, "requestId": null}