Send Template Mail¶
This interface can send a specific template message through a designated mailbox. There are custom parameters in the template message that can be replaced by the caller. When the request is successfully sent, the message sending request will be put into a message queue, and the user can receive an eventId, through which the actual sending result can be viewed later.
Request Format¶
POST https://{apigw-address}/notification-center-service/v2.0/template/email
Request Parameters (URI)¶
Name |
Location (Path/Query) |
Mandatory/Optional |
Data Type |
Description |
---|---|---|---|---|
orgId |
Quary |
Mandatory |
String |
The organization ID. How to get the orgId>> |
Request Parameters (Body)¶
Name |
Mandatory/Optional |
Data Type |
Description |
---|---|---|---|
variables |
Mandatory |
Map<String, String> |
The variables that need to be used in the mail template can be viewed in EnOS Console to select Notification Management > Mail > Mail Template. |
templateCode |
Mandatory |
String |
Template identifier(Identifier) |
toAddresses |
Mandatory |
List<String> |
A list of email addresses for recipients |
ccAddresses |
Optional |
List<String> |
You need to add a list of addresses when cc ‘ing a message |
senderCode |
Mandatory |
String |
The outgoing box identifier is used to configure which mailbox to send this email through. It can be viewed in EnOS Consoleto select Notification Management > Mail > Mail Settings page. If this parameter is not passed in, it will be sent via the notice mail channel by default |
priority |
Optional |
Enum |
Message sending priority, P2 by default, no special configuration required |
extras |
Optional |
/ |
The SYS_TABLE variable is replaced only if a custom multi-row table needs to be added within the message |
Response Parameters¶
Name |
Mandatory/Optional |
Data Type |
Description |
---|---|---|---|
eventId |
Mandatory |
String |
An eventId that returns the result for the user to query when a mail or SMS 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@envision-digital.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}