Send an email
Sends an email from an @empiricalrun.email address, with optional attachments. Each recipient must be an @empiricalrun.email address, someone who emailed the sender (with DMARC passing), or one of the project’s allowed recipients (see Allowed recipients). Use it to test apps that receive email (reply-by-email, email-to-ticket, forwarding). Replies arrive in the sender’s inbox; read them with listAddressMessages. Limits: 5 recipients and 5 attachments (5 MiB in total) per email; 10 emails per minute and 100 per rolling 24 hours per project. Emails whose recipients are all @empiricalrun.email addresses have separate, higher limits: 60 per minute and 1000 per rolling 24 hours. Over a limit the request fails with 429.
curl --request POST \
--url https://api.empirical.run/api/inboxes/send \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"from": "support-sender-k3f9@empiricalrun.email",
"to": [
"jsmith@example.com"
],
"subject": "<string>",
"cc": [
"jsmith@example.com"
],
"bcc": [
"jsmith@example.com"
],
"reply_to": "jsmith@example.com",
"text": "<string>",
"html": "<string>",
"in_reply_to": "<string>",
"references": [
"<string>"
],
"attachments": [
{
"filename": "<string>",
"content": "<string>"
}
]
}
'import requests
url = "https://api.empirical.run/api/inboxes/send"
payload = {
"from": "support-sender-k3f9@empiricalrun.email",
"to": ["jsmith@example.com"],
"subject": "<string>",
"cc": ["jsmith@example.com"],
"bcc": ["jsmith@example.com"],
"reply_to": "jsmith@example.com",
"text": "<string>",
"html": "<string>",
"in_reply_to": "<string>",
"references": ["<string>"],
"attachments": [
{
"filename": "<string>",
"content": "<string>"
}
]
}
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({
from: 'support-sender-k3f9@empiricalrun.email',
to: ['jsmith@example.com'],
subject: '<string>',
cc: ['jsmith@example.com'],
bcc: ['jsmith@example.com'],
reply_to: 'jsmith@example.com',
text: '<string>',
html: '<string>',
in_reply_to: '<string>',
references: ['<string>'],
attachments: [{filename: '<string>', content: '<string>'}]
})
};
fetch('https://api.empirical.run/api/inboxes/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.empirical.run/api/inboxes/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([
'from' => 'support-sender-k3f9@empiricalrun.email',
'to' => [
'jsmith@example.com'
],
'subject' => '<string>',
'cc' => [
'jsmith@example.com'
],
'bcc' => [
'jsmith@example.com'
],
'reply_to' => 'jsmith@example.com',
'text' => '<string>',
'html' => '<string>',
'in_reply_to' => '<string>',
'references' => [
'<string>'
],
'attachments' => [
[
'filename' => '<string>',
'content' => '<string>'
]
]
]),
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.empirical.run/api/inboxes/send"
payload := strings.NewReader("{\n \"from\": \"support-sender-k3f9@empiricalrun.email\",\n \"to\": [\n \"jsmith@example.com\"\n ],\n \"subject\": \"<string>\",\n \"cc\": [\n \"jsmith@example.com\"\n ],\n \"bcc\": [\n \"jsmith@example.com\"\n ],\n \"reply_to\": \"jsmith@example.com\",\n \"text\": \"<string>\",\n \"html\": \"<string>\",\n \"in_reply_to\": \"<string>\",\n \"references\": [\n \"<string>\"\n ],\n \"attachments\": [\n {\n \"filename\": \"<string>\",\n \"content\": \"<string>\"\n }\n ]\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.empirical.run/api/inboxes/send")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"from\": \"support-sender-k3f9@empiricalrun.email\",\n \"to\": [\n \"jsmith@example.com\"\n ],\n \"subject\": \"<string>\",\n \"cc\": [\n \"jsmith@example.com\"\n ],\n \"bcc\": [\n \"jsmith@example.com\"\n ],\n \"reply_to\": \"jsmith@example.com\",\n \"text\": \"<string>\",\n \"html\": \"<string>\",\n \"in_reply_to\": \"<string>\",\n \"references\": [\n \"<string>\"\n ],\n \"attachments\": [\n {\n \"filename\": \"<string>\",\n \"content\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.empirical.run/api/inboxes/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 \"from\": \"support-sender-k3f9@empiricalrun.email\",\n \"to\": [\n \"jsmith@example.com\"\n ],\n \"subject\": \"<string>\",\n \"cc\": [\n \"jsmith@example.com\"\n ],\n \"bcc\": [\n \"jsmith@example.com\"\n ],\n \"reply_to\": \"jsmith@example.com\",\n \"text\": \"<string>\",\n \"html\": \"<string>\",\n \"in_reply_to\": \"<string>\",\n \"references\": [\n \"<string>\"\n ],\n \"attachments\": [\n {\n \"filename\": \"<string>\",\n \"content\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": {
"message_id": "<string>",
"sent_at": "<string>"
}
}{
"data": "<unknown>",
"error": {
"message": "<string>"
}
}{
"data": "<unknown>",
"error": {
"message": "<string>"
}
}{
"data": "<unknown>",
"error": {
"message": "<string>"
}
}{
"data": "<unknown>",
"error": {
"message": "<string>"
}
}{
"data": "<unknown>",
"error": {
"message": "<string>"
}
}Authorizations
Body
Plain-text body.
Was this page helpful?
curl --request POST \
--url https://api.empirical.run/api/inboxes/send \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"from": "support-sender-k3f9@empiricalrun.email",
"to": [
"jsmith@example.com"
],
"subject": "<string>",
"cc": [
"jsmith@example.com"
],
"bcc": [
"jsmith@example.com"
],
"reply_to": "jsmith@example.com",
"text": "<string>",
"html": "<string>",
"in_reply_to": "<string>",
"references": [
"<string>"
],
"attachments": [
{
"filename": "<string>",
"content": "<string>"
}
]
}
'import requests
url = "https://api.empirical.run/api/inboxes/send"
payload = {
"from": "support-sender-k3f9@empiricalrun.email",
"to": ["jsmith@example.com"],
"subject": "<string>",
"cc": ["jsmith@example.com"],
"bcc": ["jsmith@example.com"],
"reply_to": "jsmith@example.com",
"text": "<string>",
"html": "<string>",
"in_reply_to": "<string>",
"references": ["<string>"],
"attachments": [
{
"filename": "<string>",
"content": "<string>"
}
]
}
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({
from: 'support-sender-k3f9@empiricalrun.email',
to: ['jsmith@example.com'],
subject: '<string>',
cc: ['jsmith@example.com'],
bcc: ['jsmith@example.com'],
reply_to: 'jsmith@example.com',
text: '<string>',
html: '<string>',
in_reply_to: '<string>',
references: ['<string>'],
attachments: [{filename: '<string>', content: '<string>'}]
})
};
fetch('https://api.empirical.run/api/inboxes/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.empirical.run/api/inboxes/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([
'from' => 'support-sender-k3f9@empiricalrun.email',
'to' => [
'jsmith@example.com'
],
'subject' => '<string>',
'cc' => [
'jsmith@example.com'
],
'bcc' => [
'jsmith@example.com'
],
'reply_to' => 'jsmith@example.com',
'text' => '<string>',
'html' => '<string>',
'in_reply_to' => '<string>',
'references' => [
'<string>'
],
'attachments' => [
[
'filename' => '<string>',
'content' => '<string>'
]
]
]),
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.empirical.run/api/inboxes/send"
payload := strings.NewReader("{\n \"from\": \"support-sender-k3f9@empiricalrun.email\",\n \"to\": [\n \"jsmith@example.com\"\n ],\n \"subject\": \"<string>\",\n \"cc\": [\n \"jsmith@example.com\"\n ],\n \"bcc\": [\n \"jsmith@example.com\"\n ],\n \"reply_to\": \"jsmith@example.com\",\n \"text\": \"<string>\",\n \"html\": \"<string>\",\n \"in_reply_to\": \"<string>\",\n \"references\": [\n \"<string>\"\n ],\n \"attachments\": [\n {\n \"filename\": \"<string>\",\n \"content\": \"<string>\"\n }\n ]\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.empirical.run/api/inboxes/send")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"from\": \"support-sender-k3f9@empiricalrun.email\",\n \"to\": [\n \"jsmith@example.com\"\n ],\n \"subject\": \"<string>\",\n \"cc\": [\n \"jsmith@example.com\"\n ],\n \"bcc\": [\n \"jsmith@example.com\"\n ],\n \"reply_to\": \"jsmith@example.com\",\n \"text\": \"<string>\",\n \"html\": \"<string>\",\n \"in_reply_to\": \"<string>\",\n \"references\": [\n \"<string>\"\n ],\n \"attachments\": [\n {\n \"filename\": \"<string>\",\n \"content\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.empirical.run/api/inboxes/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 \"from\": \"support-sender-k3f9@empiricalrun.email\",\n \"to\": [\n \"jsmith@example.com\"\n ],\n \"subject\": \"<string>\",\n \"cc\": [\n \"jsmith@example.com\"\n ],\n \"bcc\": [\n \"jsmith@example.com\"\n ],\n \"reply_to\": \"jsmith@example.com\",\n \"text\": \"<string>\",\n \"html\": \"<string>\",\n \"in_reply_to\": \"<string>\",\n \"references\": [\n \"<string>\"\n ],\n \"attachments\": [\n {\n \"filename\": \"<string>\",\n \"content\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": {
"message_id": "<string>",
"sent_at": "<string>"
}
}{
"data": "<unknown>",
"error": {
"message": "<string>"
}
}{
"data": "<unknown>",
"error": {
"message": "<string>"
}
}{
"data": "<unknown>",
"error": {
"message": "<string>"
}
}{
"data": "<unknown>",
"error": {
"message": "<string>"
}
}{
"data": "<unknown>",
"error": {
"message": "<string>"
}
}