Sending
Send Email
Sends a transactional or marketing email. Either templateId OR html/text content must be provided. If using a template, subject is optional.
POST
/
mails
/
send
curl --request POST \
--url https://api.autosend.com/v1/mails/send \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"to": {
"email": "[email protected]",
"name": "Jane Smith"
},
"cc": [
{"email": "[email protected]", "name": "CC User 1"},
{"email": "[email protected]", "name": "CC User 2"}
],
"bcc": [{"email": "[email protected]"}],
"from": {
"email": "[email protected]",
"name": "Your Company"
},
"subject": "Welcome to Our Platform!",
"html": "<h1>Welcome, {{name}}!</h1><p>Thanks for signing up.</p>",
"dynamicData": {
"name": "Jane"
},
"replyTo": {
"email": "[email protected]"
}
}'
import requests
url = "https://api.autosend.com/v1/mails/send"
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
payload = {
"to": {
"email": "[email protected]",
"name": "Jane Smith"
},
"cc": [
{"email": "[email protected]", "name": "CC User 1"},
{"email": "[email protected]", "name": "CC User 2"}
],
"bcc": [{"email": "[email protected]"}],
"from": {
"email": "[email protected]",
"name": "Your Company"
},
"subject": "Welcome to Our Platform!",
"html": "<h1>Welcome, {{name}}!</h1><p>Thanks for signing up.</p>",
"dynamicData": {
"name": "Jane"
},
"replyTo": {
"email": "[email protected]"
}
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
fetch('https://api.autosend.com/v1/mails/send', {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'Content-Type': 'application/json',
},
body: JSON.stringify({
to: {
email: '[email protected]',
name: 'Jane Smith',
},
from: {
email: '[email protected]',
name: 'Your Company',
},
subject: 'Welcome to Our Platform!',
html: '<h1>Welcome, {{name}}!</h1><p>Thanks for signing up.</p>',
dynamicData: {
name: 'Jane',
},
replyTo: {
email: '[email protected]',
},
}),
})
.then((response) => response.json())
.then((data) => console.log(data))
.catch((error) => console.error('Error:', error));
<?php
$url = 'https://api.autosend.com/v1/mails/send';
$data = [
'to' => [
'email' => '[email protected]',
'name' => 'Jane Smith'
],
'from' => [
'email' => '[email protected]',
'name' => 'Your Company'
],
'subject' => 'Welcome to Our Platform!',
'html' => '<h1>Welcome, {{name}}!</h1><p>Thanks for signing up.</p>',
'dynamicData' => [
'name' => 'Jane'
],
'replyTo' => [
'email' => '[email protected]'
]
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer <token>',
'Content-Type: application/json'
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
url := "https://api.autosend.com/v1/mails/send"
payload := map[string]interface{}{
"to": map[string]string{
"email": "[email protected]",
"name": "Jane Smith",
},
"from": map[string]string{
"email": "[email protected]",
"name": "Your Company",
},
"subject": "Welcome to Our Platform!",
"html": "<h1>Welcome, {{name}}!</h1><p>Thanks for signing up.</p>",
"dynamicData": map[string]string{
"name": "Jane",
},
"replyTo": map[string]string{
"email": "[email protected]",
},
}
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("Authorization", "Bearer <token>")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error:", err)
return
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
public class SendEmail {
public static void main(String[] args) {
try {
URL url = new URL("https://api.autosend.com/v1/mails/send");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Authorization", "Bearer <token>");
con.setRequestProperty("Content-Type", "application/json");
con.setDoOutput(true);
String jsonInputString = "{\n" +
" \"to\": {\n" +
" \"email\": \"[email protected]\",\n" +
" \"name\": \"Jane Smith\"\n" +
" },\n" +
" \"from\": {\n" +
" \"email\": \"[email protected]\",\n" +
" \"name\": \"Your Company\"\n" +
" },\n" +
" \"subject\": \"Welcome to Our Platform!\",\n" +
" \"html\": \"<h1>Welcome, {{name}}!</h1><p>Thanks for signing up.</p>\",\n" +
" \"dynamicData\": {\n" +
" \"name\": \"Jane\"\n" +
" },\n" +
" \"replyTo\": {\n" +
" \"email\": \"[email protected]\"\n" +
" }\n" +
"}";
try (OutputStream os = con.getOutputStream()) {
byte[] input = jsonInputString.getBytes(StandardCharsets.UTF_8);
os.write(input, 0, input.length);
}
int status = con.getResponseCode();
System.out.println("Response Status: " + status);
} catch (Exception e) {
e.printStackTrace();
}
}
}
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://api.autosend.com/v1/mails/send')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri.path)
request['Authorization'] = 'Bearer <token>'
request['Content-Type'] = 'application/json'
request.body = {
to: {
email: '[email protected]',
name: 'Jane Smith'
},
from: {
email: '[email protected]',
name: 'Your Company'
},
subject: 'Welcome to Our Platform!',
html: '<h1>Welcome, {{name}}!</h1><p>Thanks for signing up.</p>',
dynamicData: {
name: 'Jane'
},
replyTo: {
email: '[email protected]'
}
}.to_json
response = http.request(request)
puts response.body
{
"success": true,
"data": {
"emailId": "698afb75ff4bc5466e3a797a",
"message": "Email queued successfully.",
"totalRecipients": 1
}
}
curl --request POST \
--url https://api.autosend.com/v1/mails/send \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"to": {
"email": "[email protected]",
"name": "Jane Smith"
},
"cc": [
{"email": "[email protected]", "name": "CC User 1"},
{"email": "[email protected]", "name": "CC User 2"}
],
"bcc": [{"email": "[email protected]"}],
"from": {
"email": "[email protected]",
"name": "Your Company"
},
"subject": "Welcome to Our Platform!",
"html": "<h1>Welcome, {{name}}!</h1><p>Thanks for signing up.</p>",
"dynamicData": {
"name": "Jane"
},
"replyTo": {
"email": "[email protected]"
}
}'
import requests
url = "https://api.autosend.com/v1/mails/send"
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
payload = {
"to": {
"email": "[email protected]",
"name": "Jane Smith"
},
"cc": [
{"email": "[email protected]", "name": "CC User 1"},
{"email": "[email protected]", "name": "CC User 2"}
],
"bcc": [{"email": "[email protected]"}],
"from": {
"email": "[email protected]",
"name": "Your Company"
},
"subject": "Welcome to Our Platform!",
"html": "<h1>Welcome, {{name}}!</h1><p>Thanks for signing up.</p>",
"dynamicData": {
"name": "Jane"
},
"replyTo": {
"email": "[email protected]"
}
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
fetch('https://api.autosend.com/v1/mails/send', {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'Content-Type': 'application/json',
},
body: JSON.stringify({
to: {
email: '[email protected]',
name: 'Jane Smith',
},
from: {
email: '[email protected]',
name: 'Your Company',
},
subject: 'Welcome to Our Platform!',
html: '<h1>Welcome, {{name}}!</h1><p>Thanks for signing up.</p>',
dynamicData: {
name: 'Jane',
},
replyTo: {
email: '[email protected]',
},
}),
})
.then((response) => response.json())
.then((data) => console.log(data))
.catch((error) => console.error('Error:', error));
<?php
$url = 'https://api.autosend.com/v1/mails/send';
$data = [
'to' => [
'email' => '[email protected]',
'name' => 'Jane Smith'
],
'from' => [
'email' => '[email protected]',
'name' => 'Your Company'
],
'subject' => 'Welcome to Our Platform!',
'html' => '<h1>Welcome, {{name}}!</h1><p>Thanks for signing up.</p>',
'dynamicData' => [
'name' => 'Jane'
],
'replyTo' => [
'email' => '[email protected]'
]
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer <token>',
'Content-Type: application/json'
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
url := "https://api.autosend.com/v1/mails/send"
payload := map[string]interface{}{
"to": map[string]string{
"email": "[email protected]",
"name": "Jane Smith",
},
"from": map[string]string{
"email": "[email protected]",
"name": "Your Company",
},
"subject": "Welcome to Our Platform!",
"html": "<h1>Welcome, {{name}}!</h1><p>Thanks for signing up.</p>",
"dynamicData": map[string]string{
"name": "Jane",
},
"replyTo": map[string]string{
"email": "[email protected]",
},
}
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("Authorization", "Bearer <token>")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error:", err)
return
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
public class SendEmail {
public static void main(String[] args) {
try {
URL url = new URL("https://api.autosend.com/v1/mails/send");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Authorization", "Bearer <token>");
con.setRequestProperty("Content-Type", "application/json");
con.setDoOutput(true);
String jsonInputString = "{\n" +
" \"to\": {\n" +
" \"email\": \"[email protected]\",\n" +
" \"name\": \"Jane Smith\"\n" +
" },\n" +
" \"from\": {\n" +
" \"email\": \"[email protected]\",\n" +
" \"name\": \"Your Company\"\n" +
" },\n" +
" \"subject\": \"Welcome to Our Platform!\",\n" +
" \"html\": \"<h1>Welcome, {{name}}!</h1><p>Thanks for signing up.</p>\",\n" +
" \"dynamicData\": {\n" +
" \"name\": \"Jane\"\n" +
" },\n" +
" \"replyTo\": {\n" +
" \"email\": \"[email protected]\"\n" +
" }\n" +
"}";
try (OutputStream os = con.getOutputStream()) {
byte[] input = jsonInputString.getBytes(StandardCharsets.UTF_8);
os.write(input, 0, input.length);
}
int status = con.getResponseCode();
System.out.println("Response Status: " + status);
} catch (Exception e) {
e.printStackTrace();
}
}
}
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://api.autosend.com/v1/mails/send')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri.path)
request['Authorization'] = 'Bearer <token>'
request['Content-Type'] = 'application/json'
request.body = {
to: {
email: '[email protected]',
name: 'Jane Smith'
},
from: {
email: '[email protected]',
name: 'Your Company'
},
subject: 'Welcome to Our Platform!',
html: '<h1>Welcome, {{name}}!</h1><p>Thanks for signing up.</p>',
dynamicData: {
name: 'Jane'
},
replyTo: {
email: '[email protected]'
}
}.to_json
response = http.request(request)
puts response.body
{
"success": true,
"data": {
"emailId": "698afb75ff4bc5466e3a797a",
"message": "Email queued successfully.",
"totalRecipients": 1
}
}
Authorizations
string | header
required
Bearer authentication header of the form Bearer
<token>, where <token> is your auth token.Body
Email data to sendobject
required
Recipient email address and name
Show child attributes
Show child attributes
string<email>
required
Email addressExample:
"[email protected]"string
Display nameExample:
"Jane Smith"To send to multiple recipients, use the send bulk email
endpoint.
object[]
Cc Recipients array of email address and name object
Show child attributes
Show child attributes
string<email>
required
Email addressExample:
"[email protected]"string
Cc User nameExample:
"Cc User Name"object[]
Bcc Recipients array of email address and name object
Show child attributes
Show child attributes
string<email>
required
Email addressExample:
"[email protected]"string
Bcc User nameExample:
"Bcc User Name"The total combined recipients across
to, cc, and bcc cannot exceed 50 per email.object
required
Sender email address (must be from a verified domain) and name
Show child attributes
Show child attributes
string<email>
required
Email addressExample:
"[email protected]"string
Display nameExample:
"Your Company"string
required
Email subject line (max 998 characters). Required if not using templateId. Maximum length:
998
Example: "Welcome to Our Platform!"string
HTML content of the email. Required if not using templateId. Handlebars Template Variables:
Use Handlebars syntax for template variables in your HTML. Variables are wrapped in double curly
braces:
{{ variableName }}. Example: html <h1>Hello {{ firstName }}!</h1> <p>Your order #{{ orderNumber }} has been shipped.</p> <p>Total: {{ orderTotal }}</p> Provide the values for these variables in the dynamicData field. Example: jsx html: " <p>Hello {{ firstName }}! Sending this email via AutoSend.</p>" object
Key-value pairs for template variable substitution (Handlebars syntax)Example:
dynamicData: {
"name": "Jane",
"firstName": "Jane",
"orderNumber": "ORD-12345",
"orderTotal": "$99.99"
}
string
Plain text version of the email Example:
"Welcome! Thanks for signing up."string
ID of the email template to use. Required if not providing html/text. Example:
"A-abc123"object
Reply-to email address and name
Show child attributes
Show child attributes
string<email>
required
Email addressExample:
"[email protected]"string
Display nameExample:
"John Doe"object
Key-value pairs for template variable substitution (Handlebars syntax)Example:
{
"name": "Jane",
"firstName": "Jane",
"orderNumber": "ORD-12345",
"orderTotal": "$99.99"
}
string
ID of the unsubscribe group Example:
"unsub_group_123"boolean
Enable or disable click tracking for links in the email. When enabled, links are rewritten so clicks can be tracked. If omitted, the project-level setting configured in your AutoSend dashboard is used.Example:
falseboolean
Enable or disable open tracking for the email. When enabled, a tracking pixel is added to record opens. If omitted, the project-level setting configured in your AutoSend dashboard is used.Example:
falseobject
Custom email headers to include with the message as key-value pairs.Example:
- Maximum 20 custom headers per email.
- Header names must match
^[A-Za-z0-9-]{1,76}$(ASCII letters, digits, and hyphens, up to 76 characters). - Header values can be up to 1000 characters.
- Reserved headers managed by AutoSend or the underlying mail transport cannot be overridden, including:
From,To,Cc,Bcc,Subject,Date,Message-ID,Return-Path,Sender,Reply-To,Received,DKIM-Signature,MIME-Version,Content-Type,Content-Transfer-Encoding,List-Unsubscribe,List-Unsubscribe-Post,X-SES-Configuration-Set, andX-SES-Message-Tags.
headers: {
"X-Entity-Ref-ID": "order-12345",
"X-Campaign-ID": "welcome-series"
}
object[]
Filename and content of attachments.
Example:
Maximum 20 files can be attached to an email. The total size of the email should be max 40MB after Base64 encoding of the attachments.
Show child attributes
Show child attributes
string
required
Filename of the attachmentExample:
"attachment.pdf"string
Base64-encoded content of the attachment
string
Content type of the attachment (e.g. application/pdf, image/png, image/jpeg)
string
File URL where the attachment is hosted (required if content is not provided)
string
Description of the attachment (optional)
Show all supported types
Show all supported types
.adp .app .asp .bas .bat
.cer .chm .cmd .com .cpl
.crt .csh .der .exe .fxp
.gadget .hlp .hta .inf .ins
.isp .its .js .jse .ksh
.lib .lnk .mad .maf .mag
.mam .maq .mar .mas .mat
.mau .mav .maw .mda .mdb
.mde .mdt .mdw .mdz .msc
.msh .msh1 .msh2 .mshxml .msh1xml
.msh2xml .msi .msp .mst .ops
.pcd .pif .plg .prf .prg
.reg .scf .scr .sct .shb
.shs .sys .ps1 .ps1xml .ps2
.ps2xml .psc1 .psc2 .tmp .url
.vb .vbe .vbs .vps .vsmacros
.vss .vst .vsw .vxd .ws
.wsc .wsf .wsh .xnkattachments: [
{
"fileName": "attachment.pdf",
"content": "base64-encoded-content",
"contentType": "application/pdf"
}
]
boolean
When set to
true, the email is delivered even if the recipient has unsubscribed from all groups or is on your suppression list. Reserve this for critical transactional emails that a recipient must receive regardless of their marketing preferences, such as one-time passwords, security alerts, and account verifications.Use this flag sparingly and only for genuinely essential messages. Sending to suppressed or bounced addresses drives up your bounce rate, and a high bounce rate can place your account under review or affect your sending reputation.
Response
Email queued successfullyboolean
Indicates if the request was successful Example:
trueWas this page helpful?
⌘I
curl --request POST \
--url https://api.autosend.com/v1/mails/send \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"to": {
"email": "[email protected]",
"name": "Jane Smith"
},
"cc": [
{"email": "[email protected]", "name": "CC User 1"},
{"email": "[email protected]", "name": "CC User 2"}
],
"bcc": [{"email": "[email protected]"}],
"from": {
"email": "[email protected]",
"name": "Your Company"
},
"subject": "Welcome to Our Platform!",
"html": "<h1>Welcome, {{name}}!</h1><p>Thanks for signing up.</p>",
"dynamicData": {
"name": "Jane"
},
"replyTo": {
"email": "[email protected]"
}
}'
import requests
url = "https://api.autosend.com/v1/mails/send"
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
payload = {
"to": {
"email": "[email protected]",
"name": "Jane Smith"
},
"cc": [
{"email": "[email protected]", "name": "CC User 1"},
{"email": "[email protected]", "name": "CC User 2"}
],
"bcc": [{"email": "[email protected]"}],
"from": {
"email": "[email protected]",
"name": "Your Company"
},
"subject": "Welcome to Our Platform!",
"html": "<h1>Welcome, {{name}}!</h1><p>Thanks for signing up.</p>",
"dynamicData": {
"name": "Jane"
},
"replyTo": {
"email": "[email protected]"
}
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
fetch('https://api.autosend.com/v1/mails/send', {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'Content-Type': 'application/json',
},
body: JSON.stringify({
to: {
email: '[email protected]',
name: 'Jane Smith',
},
from: {
email: '[email protected]',
name: 'Your Company',
},
subject: 'Welcome to Our Platform!',
html: '<h1>Welcome, {{name}}!</h1><p>Thanks for signing up.</p>',
dynamicData: {
name: 'Jane',
},
replyTo: {
email: '[email protected]',
},
}),
})
.then((response) => response.json())
.then((data) => console.log(data))
.catch((error) => console.error('Error:', error));
<?php
$url = 'https://api.autosend.com/v1/mails/send';
$data = [
'to' => [
'email' => '[email protected]',
'name' => 'Jane Smith'
],
'from' => [
'email' => '[email protected]',
'name' => 'Your Company'
],
'subject' => 'Welcome to Our Platform!',
'html' => '<h1>Welcome, {{name}}!</h1><p>Thanks for signing up.</p>',
'dynamicData' => [
'name' => 'Jane'
],
'replyTo' => [
'email' => '[email protected]'
]
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer <token>',
'Content-Type: application/json'
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
url := "https://api.autosend.com/v1/mails/send"
payload := map[string]interface{}{
"to": map[string]string{
"email": "[email protected]",
"name": "Jane Smith",
},
"from": map[string]string{
"email": "[email protected]",
"name": "Your Company",
},
"subject": "Welcome to Our Platform!",
"html": "<h1>Welcome, {{name}}!</h1><p>Thanks for signing up.</p>",
"dynamicData": map[string]string{
"name": "Jane",
},
"replyTo": map[string]string{
"email": "[email protected]",
},
}
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("Authorization", "Bearer <token>")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error:", err)
return
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
public class SendEmail {
public static void main(String[] args) {
try {
URL url = new URL("https://api.autosend.com/v1/mails/send");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Authorization", "Bearer <token>");
con.setRequestProperty("Content-Type", "application/json");
con.setDoOutput(true);
String jsonInputString = "{\n" +
" \"to\": {\n" +
" \"email\": \"[email protected]\",\n" +
" \"name\": \"Jane Smith\"\n" +
" },\n" +
" \"from\": {\n" +
" \"email\": \"[email protected]\",\n" +
" \"name\": \"Your Company\"\n" +
" },\n" +
" \"subject\": \"Welcome to Our Platform!\",\n" +
" \"html\": \"<h1>Welcome, {{name}}!</h1><p>Thanks for signing up.</p>\",\n" +
" \"dynamicData\": {\n" +
" \"name\": \"Jane\"\n" +
" },\n" +
" \"replyTo\": {\n" +
" \"email\": \"[email protected]\"\n" +
" }\n" +
"}";
try (OutputStream os = con.getOutputStream()) {
byte[] input = jsonInputString.getBytes(StandardCharsets.UTF_8);
os.write(input, 0, input.length);
}
int status = con.getResponseCode();
System.out.println("Response Status: " + status);
} catch (Exception e) {
e.printStackTrace();
}
}
}
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://api.autosend.com/v1/mails/send')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri.path)
request['Authorization'] = 'Bearer <token>'
request['Content-Type'] = 'application/json'
request.body = {
to: {
email: '[email protected]',
name: 'Jane Smith'
},
from: {
email: '[email protected]',
name: 'Your Company'
},
subject: 'Welcome to Our Platform!',
html: '<h1>Welcome, {{name}}!</h1><p>Thanks for signing up.</p>',
dynamicData: {
name: 'Jane'
},
replyTo: {
email: '[email protected]'
}
}.to_json
response = http.request(request)
puts response.body
{
"success": true,
"data": {
"emailId": "698afb75ff4bc5466e3a797a",
"message": "Email queued successfully.",
"totalRecipients": 1
}
}