curl --request POST \
--url https://api.emailr.dev/v1/emails/send \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"to": "[email protected]",
"from": "John Doe <[email protected]>",
"cc": [
"[email protected]",
"[email protected]"
],
"bcc": [
"[email protected]",
"[email protected]"
],
"subject": "Hello World",
"html": "<h1>Hello</h1>",
"text": "Hello",
"template_id": "123e4567-e89b-12d3-a456-426614174000",
"template_data": {
"name": "John",
"company": "Acme"
},
"tags": {
"campaign": "welcome",
"source": "signup"
},
"attachments": [
{
"filename": "document.pdf",
"content": "JVBERi0xLjQKJe...",
"contentType": "application/pdf"
}
],
"replyTo": {
"in_reply_to": "<[email protected]>",
"thread_id": "123e4567-e89b-12d3-a456-426614174000",
"parent_email_id": "123e4567-e89b-12d3-a456-426614174000"
},
"reply_to_email": "[email protected]",
"preview_text": "Check out our latest updates...",
"scheduled_at": "2024-01-15T10:30:00Z",
"inbox_id": "123e4567-e89b-12d3-a456-426614174000"
}
'import requests
url = "https://api.emailr.dev/v1/emails/send"
payload = {
"to": "[email protected]",
"from": "John Doe <[email protected]>",
"cc": ["[email protected]", "[email protected]"],
"bcc": ["[email protected]", "[email protected]"],
"subject": "Hello World",
"html": "<h1>Hello</h1>",
"text": "Hello",
"template_id": "123e4567-e89b-12d3-a456-426614174000",
"template_data": {
"name": "John",
"company": "Acme"
},
"tags": {
"campaign": "welcome",
"source": "signup"
},
"attachments": [
{
"filename": "document.pdf",
"content": "JVBERi0xLjQKJe...",
"contentType": "application/pdf"
}
],
"replyTo": {
"in_reply_to": "<[email protected]>",
"thread_id": "123e4567-e89b-12d3-a456-426614174000",
"parent_email_id": "123e4567-e89b-12d3-a456-426614174000"
},
"reply_to_email": "[email protected]",
"preview_text": "Check out our latest updates...",
"scheduled_at": "2024-01-15T10:30:00Z",
"inbox_id": "123e4567-e89b-12d3-a456-426614174000"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
to: '[email protected]',
from: 'John Doe <[email protected]>',
cc: ['[email protected]', '[email protected]'],
bcc: ['[email protected]', '[email protected]'],
subject: 'Hello World',
html: '<h1>Hello</h1>',
text: 'Hello',
template_id: '123e4567-e89b-12d3-a456-426614174000',
template_data: {name: 'John', company: 'Acme'},
tags: {campaign: 'welcome', source: 'signup'},
attachments: [
{
filename: 'document.pdf',
content: 'JVBERi0xLjQKJe...',
contentType: 'application/pdf'
}
],
replyTo: {
in_reply_to: '<[email protected]>',
thread_id: '123e4567-e89b-12d3-a456-426614174000',
parent_email_id: '123e4567-e89b-12d3-a456-426614174000'
},
reply_to_email: '[email protected]',
preview_text: 'Check out our latest updates...',
scheduled_at: '2024-01-15T10:30:00Z',
inbox_id: '123e4567-e89b-12d3-a456-426614174000'
})
};
fetch('https://api.emailr.dev/v1/emails/send', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.emailr.dev/v1/emails/send",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'to' => '[email protected]',
'from' => 'John Doe <[email protected]>',
'cc' => [
'[email protected]',
'[email protected]'
],
'bcc' => [
'[email protected]',
'[email protected]'
],
'subject' => 'Hello World',
'html' => '<h1>Hello</h1>',
'text' => 'Hello',
'template_id' => '123e4567-e89b-12d3-a456-426614174000',
'template_data' => [
'name' => 'John',
'company' => 'Acme'
],
'tags' => [
'campaign' => 'welcome',
'source' => 'signup'
],
'attachments' => [
[
'filename' => 'document.pdf',
'content' => 'JVBERi0xLjQKJe...',
'contentType' => 'application/pdf'
]
],
'replyTo' => [
'in_reply_to' => '<[email protected]>',
'thread_id' => '123e4567-e89b-12d3-a456-426614174000',
'parent_email_id' => '123e4567-e89b-12d3-a456-426614174000'
],
'reply_to_email' => '[email protected]',
'preview_text' => 'Check out our latest updates...',
'scheduled_at' => '2024-01-15T10:30:00Z',
'inbox_id' => '123e4567-e89b-12d3-a456-426614174000'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.emailr.dev/v1/emails/send"
payload := strings.NewReader("{\n \"to\": \"[email protected]\",\n \"from\": \"John Doe <[email protected]>\",\n \"cc\": [\n \"[email protected]\",\n \"[email protected]\"\n ],\n \"bcc\": [\n \"[email protected]\",\n \"[email protected]\"\n ],\n \"subject\": \"Hello World\",\n \"html\": \"<h1>Hello</h1>\",\n \"text\": \"Hello\",\n \"template_id\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"template_data\": {\n \"name\": \"John\",\n \"company\": \"Acme\"\n },\n \"tags\": {\n \"campaign\": \"welcome\",\n \"source\": \"signup\"\n },\n \"attachments\": [\n {\n \"filename\": \"document.pdf\",\n \"content\": \"JVBERi0xLjQKJe...\",\n \"contentType\": \"application/pdf\"\n }\n ],\n \"replyTo\": {\n \"in_reply_to\": \"<[email protected]>\",\n \"thread_id\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"parent_email_id\": \"123e4567-e89b-12d3-a456-426614174000\"\n },\n \"reply_to_email\": \"[email protected]\",\n \"preview_text\": \"Check out our latest updates...\",\n \"scheduled_at\": \"2024-01-15T10:30:00Z\",\n \"inbox_id\": \"123e4567-e89b-12d3-a456-426614174000\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.emailr.dev/v1/emails/send")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"to\": \"[email protected]\",\n \"from\": \"John Doe <[email protected]>\",\n \"cc\": [\n \"[email protected]\",\n \"[email protected]\"\n ],\n \"bcc\": [\n \"[email protected]\",\n \"[email protected]\"\n ],\n \"subject\": \"Hello World\",\n \"html\": \"<h1>Hello</h1>\",\n \"text\": \"Hello\",\n \"template_id\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"template_data\": {\n \"name\": \"John\",\n \"company\": \"Acme\"\n },\n \"tags\": {\n \"campaign\": \"welcome\",\n \"source\": \"signup\"\n },\n \"attachments\": [\n {\n \"filename\": \"document.pdf\",\n \"content\": \"JVBERi0xLjQKJe...\",\n \"contentType\": \"application/pdf\"\n }\n ],\n \"replyTo\": {\n \"in_reply_to\": \"<[email protected]>\",\n \"thread_id\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"parent_email_id\": \"123e4567-e89b-12d3-a456-426614174000\"\n },\n \"reply_to_email\": \"[email protected]\",\n \"preview_text\": \"Check out our latest updates...\",\n \"scheduled_at\": \"2024-01-15T10:30:00Z\",\n \"inbox_id\": \"123e4567-e89b-12d3-a456-426614174000\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.emailr.dev/v1/emails/send")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"to\": \"[email protected]\",\n \"from\": \"John Doe <[email protected]>\",\n \"cc\": [\n \"[email protected]\",\n \"[email protected]\"\n ],\n \"bcc\": [\n \"[email protected]\",\n \"[email protected]\"\n ],\n \"subject\": \"Hello World\",\n \"html\": \"<h1>Hello</h1>\",\n \"text\": \"Hello\",\n \"template_id\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"template_data\": {\n \"name\": \"John\",\n \"company\": \"Acme\"\n },\n \"tags\": {\n \"campaign\": \"welcome\",\n \"source\": \"signup\"\n },\n \"attachments\": [\n {\n \"filename\": \"document.pdf\",\n \"content\": \"JVBERi0xLjQKJe...\",\n \"contentType\": \"application/pdf\"\n }\n ],\n \"replyTo\": {\n \"in_reply_to\": \"<[email protected]>\",\n \"thread_id\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"parent_email_id\": \"123e4567-e89b-12d3-a456-426614174000\"\n },\n \"reply_to_email\": \"[email protected]\",\n \"preview_text\": \"Check out our latest updates...\",\n \"scheduled_at\": \"2024-01-15T10:30:00Z\",\n \"inbox_id\": \"123e4567-e89b-12d3-a456-426614174000\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message_id": "123e4567-e89b-12d3-a456-426614174000",
"recipients": 1,
"scheduled_at": "2024-01-15T10:30:00Z",
"status": "sent"
}{
"error": "An error occurred",
"code": "VALIDATION_ERROR",
"details": "<unknown>"
}{
"error": "An error occurred",
"code": "VALIDATION_ERROR",
"details": "<unknown>"
}{
"error": "An error occurred",
"code": "VALIDATION_ERROR",
"details": "<unknown>"
}Send an email
Send an email to one or multiple recipients
curl --request POST \
--url https://api.emailr.dev/v1/emails/send \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"to": "[email protected]",
"from": "John Doe <[email protected]>",
"cc": [
"[email protected]",
"[email protected]"
],
"bcc": [
"[email protected]",
"[email protected]"
],
"subject": "Hello World",
"html": "<h1>Hello</h1>",
"text": "Hello",
"template_id": "123e4567-e89b-12d3-a456-426614174000",
"template_data": {
"name": "John",
"company": "Acme"
},
"tags": {
"campaign": "welcome",
"source": "signup"
},
"attachments": [
{
"filename": "document.pdf",
"content": "JVBERi0xLjQKJe...",
"contentType": "application/pdf"
}
],
"replyTo": {
"in_reply_to": "<[email protected]>",
"thread_id": "123e4567-e89b-12d3-a456-426614174000",
"parent_email_id": "123e4567-e89b-12d3-a456-426614174000"
},
"reply_to_email": "[email protected]",
"preview_text": "Check out our latest updates...",
"scheduled_at": "2024-01-15T10:30:00Z",
"inbox_id": "123e4567-e89b-12d3-a456-426614174000"
}
'import requests
url = "https://api.emailr.dev/v1/emails/send"
payload = {
"to": "[email protected]",
"from": "John Doe <[email protected]>",
"cc": ["[email protected]", "[email protected]"],
"bcc": ["[email protected]", "[email protected]"],
"subject": "Hello World",
"html": "<h1>Hello</h1>",
"text": "Hello",
"template_id": "123e4567-e89b-12d3-a456-426614174000",
"template_data": {
"name": "John",
"company": "Acme"
},
"tags": {
"campaign": "welcome",
"source": "signup"
},
"attachments": [
{
"filename": "document.pdf",
"content": "JVBERi0xLjQKJe...",
"contentType": "application/pdf"
}
],
"replyTo": {
"in_reply_to": "<[email protected]>",
"thread_id": "123e4567-e89b-12d3-a456-426614174000",
"parent_email_id": "123e4567-e89b-12d3-a456-426614174000"
},
"reply_to_email": "[email protected]",
"preview_text": "Check out our latest updates...",
"scheduled_at": "2024-01-15T10:30:00Z",
"inbox_id": "123e4567-e89b-12d3-a456-426614174000"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
to: '[email protected]',
from: 'John Doe <[email protected]>',
cc: ['[email protected]', '[email protected]'],
bcc: ['[email protected]', '[email protected]'],
subject: 'Hello World',
html: '<h1>Hello</h1>',
text: 'Hello',
template_id: '123e4567-e89b-12d3-a456-426614174000',
template_data: {name: 'John', company: 'Acme'},
tags: {campaign: 'welcome', source: 'signup'},
attachments: [
{
filename: 'document.pdf',
content: 'JVBERi0xLjQKJe...',
contentType: 'application/pdf'
}
],
replyTo: {
in_reply_to: '<[email protected]>',
thread_id: '123e4567-e89b-12d3-a456-426614174000',
parent_email_id: '123e4567-e89b-12d3-a456-426614174000'
},
reply_to_email: '[email protected]',
preview_text: 'Check out our latest updates...',
scheduled_at: '2024-01-15T10:30:00Z',
inbox_id: '123e4567-e89b-12d3-a456-426614174000'
})
};
fetch('https://api.emailr.dev/v1/emails/send', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.emailr.dev/v1/emails/send",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'to' => '[email protected]',
'from' => 'John Doe <[email protected]>',
'cc' => [
'[email protected]',
'[email protected]'
],
'bcc' => [
'[email protected]',
'[email protected]'
],
'subject' => 'Hello World',
'html' => '<h1>Hello</h1>',
'text' => 'Hello',
'template_id' => '123e4567-e89b-12d3-a456-426614174000',
'template_data' => [
'name' => 'John',
'company' => 'Acme'
],
'tags' => [
'campaign' => 'welcome',
'source' => 'signup'
],
'attachments' => [
[
'filename' => 'document.pdf',
'content' => 'JVBERi0xLjQKJe...',
'contentType' => 'application/pdf'
]
],
'replyTo' => [
'in_reply_to' => '<[email protected]>',
'thread_id' => '123e4567-e89b-12d3-a456-426614174000',
'parent_email_id' => '123e4567-e89b-12d3-a456-426614174000'
],
'reply_to_email' => '[email protected]',
'preview_text' => 'Check out our latest updates...',
'scheduled_at' => '2024-01-15T10:30:00Z',
'inbox_id' => '123e4567-e89b-12d3-a456-426614174000'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.emailr.dev/v1/emails/send"
payload := strings.NewReader("{\n \"to\": \"[email protected]\",\n \"from\": \"John Doe <[email protected]>\",\n \"cc\": [\n \"[email protected]\",\n \"[email protected]\"\n ],\n \"bcc\": [\n \"[email protected]\",\n \"[email protected]\"\n ],\n \"subject\": \"Hello World\",\n \"html\": \"<h1>Hello</h1>\",\n \"text\": \"Hello\",\n \"template_id\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"template_data\": {\n \"name\": \"John\",\n \"company\": \"Acme\"\n },\n \"tags\": {\n \"campaign\": \"welcome\",\n \"source\": \"signup\"\n },\n \"attachments\": [\n {\n \"filename\": \"document.pdf\",\n \"content\": \"JVBERi0xLjQKJe...\",\n \"contentType\": \"application/pdf\"\n }\n ],\n \"replyTo\": {\n \"in_reply_to\": \"<[email protected]>\",\n \"thread_id\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"parent_email_id\": \"123e4567-e89b-12d3-a456-426614174000\"\n },\n \"reply_to_email\": \"[email protected]\",\n \"preview_text\": \"Check out our latest updates...\",\n \"scheduled_at\": \"2024-01-15T10:30:00Z\",\n \"inbox_id\": \"123e4567-e89b-12d3-a456-426614174000\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.emailr.dev/v1/emails/send")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"to\": \"[email protected]\",\n \"from\": \"John Doe <[email protected]>\",\n \"cc\": [\n \"[email protected]\",\n \"[email protected]\"\n ],\n \"bcc\": [\n \"[email protected]\",\n \"[email protected]\"\n ],\n \"subject\": \"Hello World\",\n \"html\": \"<h1>Hello</h1>\",\n \"text\": \"Hello\",\n \"template_id\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"template_data\": {\n \"name\": \"John\",\n \"company\": \"Acme\"\n },\n \"tags\": {\n \"campaign\": \"welcome\",\n \"source\": \"signup\"\n },\n \"attachments\": [\n {\n \"filename\": \"document.pdf\",\n \"content\": \"JVBERi0xLjQKJe...\",\n \"contentType\": \"application/pdf\"\n }\n ],\n \"replyTo\": {\n \"in_reply_to\": \"<[email protected]>\",\n \"thread_id\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"parent_email_id\": \"123e4567-e89b-12d3-a456-426614174000\"\n },\n \"reply_to_email\": \"[email protected]\",\n \"preview_text\": \"Check out our latest updates...\",\n \"scheduled_at\": \"2024-01-15T10:30:00Z\",\n \"inbox_id\": \"123e4567-e89b-12d3-a456-426614174000\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.emailr.dev/v1/emails/send")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"to\": \"[email protected]\",\n \"from\": \"John Doe <[email protected]>\",\n \"cc\": [\n \"[email protected]\",\n \"[email protected]\"\n ],\n \"bcc\": [\n \"[email protected]\",\n \"[email protected]\"\n ],\n \"subject\": \"Hello World\",\n \"html\": \"<h1>Hello</h1>\",\n \"text\": \"Hello\",\n \"template_id\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"template_data\": {\n \"name\": \"John\",\n \"company\": \"Acme\"\n },\n \"tags\": {\n \"campaign\": \"welcome\",\n \"source\": \"signup\"\n },\n \"attachments\": [\n {\n \"filename\": \"document.pdf\",\n \"content\": \"JVBERi0xLjQKJe...\",\n \"contentType\": \"application/pdf\"\n }\n ],\n \"replyTo\": {\n \"in_reply_to\": \"<[email protected]>\",\n \"thread_id\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"parent_email_id\": \"123e4567-e89b-12d3-a456-426614174000\"\n },\n \"reply_to_email\": \"[email protected]\",\n \"preview_text\": \"Check out our latest updates...\",\n \"scheduled_at\": \"2024-01-15T10:30:00Z\",\n \"inbox_id\": \"123e4567-e89b-12d3-a456-426614174000\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message_id": "123e4567-e89b-12d3-a456-426614174000",
"recipients": 1,
"scheduled_at": "2024-01-15T10:30:00Z",
"status": "sent"
}{
"error": "An error occurred",
"code": "VALIDATION_ERROR",
"details": "<unknown>"
}{
"error": "An error occurred",
"code": "VALIDATION_ERROR",
"details": "<unknown>"
}{
"error": "An error occurred",
"code": "VALIDATION_ERROR",
"details": "<unknown>"
}Authorizations
API key authentication. Use your API key as the bearer token.
Body
Sender email. Accepts '[email protected]' or 'Name [email protected]' format. Required if not using a template with from_email set.
^(?:[^<]+<[^@\s]+@[^@\s]+\.[^@\s]+>|[^@\s]+@[^@\s]+\.[^@\s]+)$"John Doe <[email protected]>"
CC recipients
BCC recipients
Email subject. Required if not using a template.
1"Hello World"
"<h1>Hello</h1>"
"Hello"
Template ID. When provided, template values are used for subject, html, text, from, reply_to, and preview_text.
"123e4567-e89b-12d3-a456-426614174000"
Variables to render in the template. Must include all variables defined in the template.
Show child attributes
Show child attributes
{ "name": "John", "company": "Acme" }
Show child attributes
Show child attributes
{ "campaign": "welcome", "source": "signup" }
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Reply-To email address. Overrides template reply_to if provided.
Preview text (preheader). Overrides template preview_text if provided.
"Check out our latest updates..."
Schedule email to be sent at this time. If not provided, email is sent immediately.
"2024-01-15T10:30:00Z"
Inbox ID to associate with this email. If not provided, resolved from template's inbox_id.
"123e4567-e89b-12d3-a456-426614174000"
Response
Email sent successfully
true
"123e4567-e89b-12d3-a456-426614174000"
1
Present when email is scheduled
"2024-01-15T10:30:00Z"
Email status: 'sent' for immediate emails, 'scheduled' for scheduled emails
"sent"