XM
Members
Communication - Send Email
This documentation is now outdated, please find the latest docs for this endpoint here
Path:
1
POST /email/send
Copied!
Customers want to be notified on important events, particularly, the ones related to their orders. This API faciliates sending template-driven email notification. Other types of templates can be added for customer engagement such as feedback, new promotions and offers, etc.

Headers

Content-Type : application/json
x-site-context : { "date": "2020-08-28T02:35:27.787Z", "channel": 12, "account": 5f493c9f30ec2a0007a94fc8", "stage": "sandbox" }
x-api-key :d41d8cd98f00b204e9800998ecf8427e

Parameters

Type: Body
Name: Recipient email address, email subject, and email template.
Required: true

Sample Request

1
{
2
"subject": "Example email",
3
"template": "<h1>Hello World</h1><p> Hello, </p><p> This is a test email.</p>",
4
"recipientEmail": ["[email protected]"]
5
}
Copied!

Sample Response

Response Code: 200
Message: OK
Description: You will see this message when the notification email is successfully sent.
1
[
2
{
3
"statusCode": 202,
4
"headers": {
5
"server": "nginx",
6
"date": "Mon, 20 Jul 2020 11:15:19 GMT",
7
"content-length": "0",
8
"connection": "close",
9
"x-message-id": "mtahAGtDTSGqqkZ0xx-bfg",
10
"access-control-allow-origin": "https://sendgrid.api-docs.io",
11
"access-control-allow-methods": "POST",
12
"access-control-allow-headers": "Authorization, Content-Type, On-behalf-of, x-sg-elas-acl",
13
"access-control-max-age": "600",
14
"x-no-cors-reason": "https://sendgrid.com/docs/Classroom/Basics/API/cors.html"
15
},
16
"request": {
17
"uri": {
18
"protocol": "https:",
19
"slashes": true,
20
"auth": null,
21
"host": "api.sendgrid.com",
22
"port": 443,
23
"hostname": "api.sendgrid.com",
24
"hash": null,
25
"search": null,
26
"query": null,
27
"pathname": "/v3/mail/send",
28
"path": "/v3/mail/send",
29
"href": "https://api.sendgrid.com/v3/mail/send"
30
},
31
"method": "POST",
32
"headers": {
33
"Accept": "application/json",
34
"User-agent": "sendgrid/6.5.5;nodejs",
35
"Authorization": "Bearer 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",
36
"content-type": "application/json",
37
"content-length": 236
38
}
39
}
40
},
41
null
42
]
Copied!
Response Code: 400
Message: Bad Request
Description: You will see this message when the data is invalid or there are no items specified in the email.
Sample
1
{
2
"code": "REQUEST_VALIDATION",
3
"message": "Invalid data in body: /recipientEmail should NOT have fewer than 1 items"
4
}
Copied!

Changelog

  • Last updated - July 2020
Last modified 1mo ago
Copy link
Contents
Changelog