Send a outbound tempalet email.
URL
Request Method
- POST
Request Header
- content-type: application/json
- X-API-Key: apiKey
Request Examples
curl --request POST \
--url http://sgapi.yoni-tech.com/v1/email/send/template \
--header 'content-type: application/json' \
--header 'X-API-Key: Hs42eBZ6vuTR7oBSs3zq7HscgiAr6Y252Y5BbzrbKoI=' \
--data '
{
"from": "[email protected]",
"to": "[email protected]",
"templateInvokeName": "demo_template_1"
}
'
Request Parameter
Name | Optional | Type | Description |
---|---|---|---|
from | yes | String | sender email address, e.g.[email protected] , After you configure DMARC, We will take current domain as the suffix of “from”. |
to | yes | String | Recipient’s email addresses, separated by semicolons, e.g.[email protected];[email protected] . |
templateInvokeName | yes | String | calling name of email template |
subject | no | String | subject |
variables | no | String | variable of content, in JSONArrary format, e.g.[{"age": "20", "name": "tom"},{"age": "21", "name": "jerry"}] |
fromName | no | String | sender name, shown as: YoniService<[email protected]> |
cc | no | String | cc addresses, separated by semicolons |
bcc | no | String | bcc addresses, separated by semicolons |
replyTo | no | String | default reply addresses, separated by semicolons, cannot be more than 3. If “reply To” does not exist or is null, reply address defaults to “from” |
summary | no | String | content summary. When adding content summary, if content summary already exists, the former one will be replaced by the most current summary;if not, the content summary will be added to the email. |
Note
- assuming that “from” is
YoniService<[email protected]>
.If “fromName” is empty, “YoniService” will be set as “fromName”; if not, no processing is needed.- when sending emails, designate recipients with “to”. Multiple recipients are sent through multi-transmission (all recipients will be displayed). Designate cc recipients with parameter “cc”, and bcc recipients with “bcc”.
- recipients of “to”, “cc” and “bcc” cannot be more than 100.
- email content size should be no more than 200KB.
- if recipients of “subject” and “summary” not empty, template of “subject” and “summary” will not take effect.
- If it's a variable email, recipients of “cc” and “bcc” will not take effect ,at the same time, the number of objects in the variable array should be the same as the number of recipients “to”; recipients of “content”, “variables” please see the following case:
content:"<p>Hi, #name#</p><p> your order is #number#, please check it.</p><p>YoniTech</p>"; variables:[{ "name": "tom", "number": "YN-20240212382763812723" }, { "name": "jerry", "number": "YN-20240212382763812724" }]
Response Example
{
"code": "0",
"message": "success",
"data": [
{
"emailIds": [
"[email protected]",
"[email protected]"
]
}
]
}
Response Result
Name | Type | Description |
---|---|---|
code | String | YONI-TECH's respense code (error codes) |
message | String | describe the result |
data | Object | obj contain emailIds |
data.emailIds | Array | unique identifier for every email |