Skip to main content
POST
/
v1
/
inboxes
/
{id}
/
send
Send email
curl --request POST \
  --url https://api.openmail.sh/v1/inboxes/{id}/send \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'Idempotency-Key: <idempotency-key>' \
  --data '
{
  "to": "jsmith@example.com",
  "body": "<string>",
  "subject": "<string>",
  "bodyHtml": "<string>",
  "threadId": "<string>",
  "includeQuote": true,
  "replyTo": "jsmith@example.com",
  "cc": [
    "jsmith@example.com"
  ]
}
'
import requests

url = "https://api.openmail.sh/v1/inboxes/{id}/send"

payload = {
    "to": "jsmith@example.com",
    "body": "<string>",
    "subject": "<string>",
    "bodyHtml": "<string>",
    "threadId": "<string>",
    "includeQuote": True,
    "replyTo": "jsmith@example.com",
    "cc": ["jsmith@example.com"]
}
headers = {
    "Idempotency-Key": "<idempotency-key>",
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'POST',
  headers: {
    'Idempotency-Key': '<idempotency-key>',
    Authorization: 'Bearer <token>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    to: 'jsmith@example.com',
    body: JSON.stringify('<string>'),
    subject: '<string>',
    bodyHtml: '<string>',
    threadId: '<string>',
    includeQuote: true,
    replyTo: 'jsmith@example.com',
    cc: ['jsmith@example.com']
  })
};

fetch('https://api.openmail.sh/v1/inboxes/{id}/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.openmail.sh/v1/inboxes/{id}/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' => 'jsmith@example.com',
    'body' => '<string>',
    'subject' => '<string>',
    'bodyHtml' => '<string>',
    'threadId' => '<string>',
    'includeQuote' => true,
    'replyTo' => 'jsmith@example.com',
    'cc' => [
        'jsmith@example.com'
    ]
  ]),
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>",
    "Content-Type: application/json",
    "Idempotency-Key: <idempotency-key>"
  ],
]);

$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.openmail.sh/v1/inboxes/{id}/send"

	payload := strings.NewReader("{\n  \"to\": \"jsmith@example.com\",\n  \"body\": \"<string>\",\n  \"subject\": \"<string>\",\n  \"bodyHtml\": \"<string>\",\n  \"threadId\": \"<string>\",\n  \"includeQuote\": true,\n  \"replyTo\": \"jsmith@example.com\",\n  \"cc\": [\n    \"jsmith@example.com\"\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Idempotency-Key", "<idempotency-key>")
	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.openmail.sh/v1/inboxes/{id}/send")
  .header("Idempotency-Key", "<idempotency-key>")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"to\": \"jsmith@example.com\",\n  \"body\": \"<string>\",\n  \"subject\": \"<string>\",\n  \"bodyHtml\": \"<string>\",\n  \"threadId\": \"<string>\",\n  \"includeQuote\": true,\n  \"replyTo\": \"jsmith@example.com\",\n  \"cc\": [\n    \"jsmith@example.com\"\n  ]\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.openmail.sh/v1/inboxes/{id}/send")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"to\": \"jsmith@example.com\",\n  \"body\": \"<string>\",\n  \"subject\": \"<string>\",\n  \"bodyHtml\": \"<string>\",\n  \"threadId\": \"<string>\",\n  \"includeQuote\": true,\n  \"replyTo\": \"jsmith@example.com\",\n  \"cc\": [\n    \"jsmith@example.com\"\n  ]\n}"

response = http.request(request)
puts response.read_body
{
  "messageId": "<string>",
  "threadId": "<string>",
  "providerMessageId": "<string>"
}
{
  "error": "<string>",
  "message": "<string>"
}
{
  "error": "<string>",
  "message": "<string>"
}
{
  "error": "<string>",
  "message": "<string>"
}
{
  "error": "<string>",
  "message": "<string>"
}
{
  "error": "<string>",
  "message": "<string>"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

Idempotency-Key
string
required

Unique key for idempotent sends (e.g. UUID)

Path Parameters

id
string
required

Body

to
string<email>
required
body
string
required

Email body. Plain text or HTML — HTML is auto-detected and rendered, with a plain-text fallback generated automatically.

Required string length: 1 - 100000
subject
string

Required for new threads. Optional when threadId is set — the thread subject is used automatically (with Re: prefix).

Required string length: 1 - 998
bodyHtml
string

Provide only when the plain-text and HTML versions must differ. Omit for normal sends — put HTML in body instead.

Maximum string length: 500000
threadId
string

Thread ID for replies

includeQuote
boolean

When replying with threadId, append a quoted copy of the previous message to the body. Defaults to true. Set false to send only your reply text.

replyTo
string<email>

Optional. Address that replies should be routed to (set as the Reply-To MIME header). Free plan: must be the address of an inbox you own in OpenMail. Developer plan or higher: any valid email address.

cc
string<email>[]

Optional CC recipients.

Response

Email sent (or idempotent replay)

messageId
string
threadId
string
providerMessageId
string
status
enum<string>
Available options:
pending,
sent,
failed