Send Mail Template¶
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) |
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 can be viewed in EnOS Management Console to select Notification Management > Mail > Mail Template. |
templateCode |
Required |
String |
Template identifier (Identifier) |
toAddresses |
Required |
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 |
Required |
String |
The outgoing box identifier is used to configure which mailbox to send this email through. It can be viewed in EnOS Management Consoleto select Notification Management > Messages > Configurations > Mail 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 |
Required/Optional |
Data Type |
Description |
---|---|---|---|
eventId |
Required |
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@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}