Send raw HTML email
curl --request POST \
--url https://api.example.com/api/email/send-raw \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"to": "user@example.com",
"subject": "Welcome to our platform",
"html": "<h1>Welcome!</h1><p>Thank you for joining us.</p>",
"cc": "jsmith@example.com",
"bcc": "jsmith@example.com",
"from": "My App",
"replyTo": "support@example.com"
}
'import requests
url = "https://api.example.com/api/email/send-raw"
payload = {
"to": "user@example.com",
"subject": "Welcome to our platform",
"html": "<h1>Welcome!</h1><p>Thank you for joining us.</p>",
"cc": "jsmith@example.com",
"bcc": "jsmith@example.com",
"from": "My App",
"replyTo": "support@example.com"
}
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: 'user@example.com',
subject: 'Welcome to our platform',
html: '<h1>Welcome!</h1><p>Thank you for joining us.</p>',
cc: 'jsmith@example.com',
bcc: 'jsmith@example.com',
from: 'My App',
replyTo: 'support@example.com'
})
};
fetch('https://api.example.com/api/email/send-raw', 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.example.com/api/email/send-raw",
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' => 'user@example.com',
'subject' => 'Welcome to our platform',
'html' => '<h1>Welcome!</h1><p>Thank you for joining us.</p>',
'cc' => 'jsmith@example.com',
'bcc' => 'jsmith@example.com',
'from' => 'My App',
'replyTo' => 'support@example.com'
]),
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.example.com/api/email/send-raw"
payload := strings.NewReader("{\n \"to\": \"user@example.com\",\n \"subject\": \"Welcome to our platform\",\n \"html\": \"<h1>Welcome!</h1><p>Thank you for joining us.</p>\",\n \"cc\": \"jsmith@example.com\",\n \"bcc\": \"jsmith@example.com\",\n \"from\": \"My App\",\n \"replyTo\": \"support@example.com\"\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.example.com/api/email/send-raw")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"to\": \"user@example.com\",\n \"subject\": \"Welcome to our platform\",\n \"html\": \"<h1>Welcome!</h1><p>Thank you for joining us.</p>\",\n \"cc\": \"jsmith@example.com\",\n \"bcc\": \"jsmith@example.com\",\n \"from\": \"My App\",\n \"replyTo\": \"support@example.com\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/email/send-raw")
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\": \"user@example.com\",\n \"subject\": \"Welcome to our platform\",\n \"html\": \"<h1>Welcome!</h1><p>Thank you for joining us.</p>\",\n \"cc\": \"jsmith@example.com\",\n \"bcc\": \"jsmith@example.com\",\n \"from\": \"My App\",\n \"replyTo\": \"support@example.com\"\n}"
response = http.request(request)
puts response.read_body{}{
"error": "VALIDATION_ERROR",
"message": "Subject is required",
"statusCode": 400,
"nextActions": "Please provide a valid subject line"
}{
"error": "VALIDATION_ERROR",
"message": "Subject is required",
"statusCode": 400,
"nextActions": "Please provide a valid subject line"
}{
"error": "VALIDATION_ERROR",
"message": "Subject is required",
"statusCode": 400,
"nextActions": "Please provide a valid subject line"
}{
"error": "VALIDATION_ERROR",
"message": "Subject is required",
"statusCode": 400,
"nextActions": "Please provide a valid subject line"
}Client
Send raw HTML email
Send a custom HTML email to one or more recipients. Requires user authentication or a valid admin API key.
POST
/
api
/
email
/
send-raw
Send raw HTML email
curl --request POST \
--url https://api.example.com/api/email/send-raw \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"to": "user@example.com",
"subject": "Welcome to our platform",
"html": "<h1>Welcome!</h1><p>Thank you for joining us.</p>",
"cc": "jsmith@example.com",
"bcc": "jsmith@example.com",
"from": "My App",
"replyTo": "support@example.com"
}
'import requests
url = "https://api.example.com/api/email/send-raw"
payload = {
"to": "user@example.com",
"subject": "Welcome to our platform",
"html": "<h1>Welcome!</h1><p>Thank you for joining us.</p>",
"cc": "jsmith@example.com",
"bcc": "jsmith@example.com",
"from": "My App",
"replyTo": "support@example.com"
}
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: 'user@example.com',
subject: 'Welcome to our platform',
html: '<h1>Welcome!</h1><p>Thank you for joining us.</p>',
cc: 'jsmith@example.com',
bcc: 'jsmith@example.com',
from: 'My App',
replyTo: 'support@example.com'
})
};
fetch('https://api.example.com/api/email/send-raw', 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.example.com/api/email/send-raw",
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' => 'user@example.com',
'subject' => 'Welcome to our platform',
'html' => '<h1>Welcome!</h1><p>Thank you for joining us.</p>',
'cc' => 'jsmith@example.com',
'bcc' => 'jsmith@example.com',
'from' => 'My App',
'replyTo' => 'support@example.com'
]),
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.example.com/api/email/send-raw"
payload := strings.NewReader("{\n \"to\": \"user@example.com\",\n \"subject\": \"Welcome to our platform\",\n \"html\": \"<h1>Welcome!</h1><p>Thank you for joining us.</p>\",\n \"cc\": \"jsmith@example.com\",\n \"bcc\": \"jsmith@example.com\",\n \"from\": \"My App\",\n \"replyTo\": \"support@example.com\"\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.example.com/api/email/send-raw")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"to\": \"user@example.com\",\n \"subject\": \"Welcome to our platform\",\n \"html\": \"<h1>Welcome!</h1><p>Thank you for joining us.</p>\",\n \"cc\": \"jsmith@example.com\",\n \"bcc\": \"jsmith@example.com\",\n \"from\": \"My App\",\n \"replyTo\": \"support@example.com\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/email/send-raw")
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\": \"user@example.com\",\n \"subject\": \"Welcome to our platform\",\n \"html\": \"<h1>Welcome!</h1><p>Thank you for joining us.</p>\",\n \"cc\": \"jsmith@example.com\",\n \"bcc\": \"jsmith@example.com\",\n \"from\": \"My App\",\n \"replyTo\": \"support@example.com\"\n}"
response = http.request(request)
puts response.read_body{}{
"error": "VALIDATION_ERROR",
"message": "Subject is required",
"statusCode": 400,
"nextActions": "Please provide a valid subject line"
}{
"error": "VALIDATION_ERROR",
"message": "Subject is required",
"statusCode": 400,
"nextActions": "Please provide a valid subject line"
}{
"error": "VALIDATION_ERROR",
"message": "Subject is required",
"statusCode": 400,
"nextActions": "Please provide a valid subject line"
}{
"error": "VALIDATION_ERROR",
"message": "Subject is required",
"statusCode": 400,
"nextActions": "Please provide a valid subject line"
}Authorizations
bearerAuthapiKey
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Recipient email address(es) - maximum 50 recipients
Example:
"user@example.com"
Email subject line
Required string length:
1 - 500Example:
"Welcome to our platform"
HTML content of the email body
Minimum string length:
1Example:
"<h1>Welcome!</h1><p>Thank you for joining us.</p>"
Carbon copy recipient(s) - maximum 50 recipients
Blind carbon copy recipient(s) - maximum 50 recipients
Custom sender name (uses default if not provided)
Maximum string length:
100Example:
"My App"
Reply-to email address
Example:
"support@example.com"
Response
Email sent successfully
Empty object on success - extend with optional fields later if needed
Was this page helpful?
⌘I