Skip to content

Send transactional email for user domain with optional attachments

POST
/api/domains/{domain}/message

Send a transactional email for a specific domain owned by the authenticated user. This endpoint is designed for user-authenticated requests where the user owns and manages the domain. Supports comprehensive email customization, bulk sending, file attachments with advanced processing, and asynchronous job handling for optimal performance. Perfect for building custom email solutions and transactional workflows.

domain
required
string
Example
example.com

Domain name that must be owned by the authenticated user. This domain must be verified and configured with SMTP credentials.

Complete email configuration including content, recipients, and optional attachments with processing options.

object
from
required

Sender email address. Must belong to the authenticated domain. Used for envelope sender and Return-Path header.

string format: email
Example
from_name

Optional sender display name. If not provided, will use the email address only.

string
Example
Company Name
to
required
One of:
string format: email
Example
subject
required

Email subject line. Supports Unicode characters, emojis, and variable content. Keep under 78 characters for optimal display across email clients.

string
Example
Your Order Confirmation - #12345
text
required

Required plain text content for the email body. This will be used as fallback for email clients that don’t support HTML. Line breaks will be preserved.

string
Example
Dear Valued Customer,\n\nThank you for your recent order #12345. Your items are being prepared for shipment.\n\nOrder Details:\n- Product: Premium Widget\n- Quantity: 2\n- Total: $49.99\n\nTracking information will be sent once your order ships.\n\nBest regards,\nCustomer Service Team
html

Optional HTML content for the email body. If provided, this will be used for HTML email clients. Should be a complete HTML document or HTML fragment.

string
Example
<html><body><h2>Order Confirmation - #12345</h2><p>Dear Valued Customer,</p><p>Thank you for your recent order #12345. Your items are being prepared for shipment.</p><h3>Order Details:</h3><ul><li>Product: Premium Widget</li><li>Quantity: 2</li><li>Total: $49.99</li></ul><p>Tracking information will be sent once your order ships.</p><p>Best regards,<br>Customer Service Team</p></body></html>
headers
One of:
object
Example
{
"X-Order-ID": "12345",
"X-Customer-Tier": "premium",
"X-Tags": "newsletter,promo",
"List-Unsubscribe": "mailto:[email protected]",
"X-Priority": "3"
}
reply_to

Reply-to email address. Must share the same top-level domain as the ‘from’ address for security compliance.

string format: email
Example
attachments
One of:

Single file attachment

string format: binary
attachment_options

Advanced attachment processing configuration as JSON string. Enables compression, password protection, and watermarking features.

string
Example
{"compress": true, "password": "SecureDoc2024", "watermark": {"enabled": true, "text": "CONFIDENTIAL", "position": "center"}}

Email send jobs successfully dispatched for asynchronous processing

object
success

Request processing success status

boolean
Example
true
message

Detailed success message including recipient count, job batching information, and attachment count

string
Example
Email send jobs dispatched for 5 recipients in 1 job(s) with 2 attachment(s)
X-RateLimit-Limit
integer

Maximum requests per minute

X-RateLimit-Remaining
integer

Remaining requests in current window

Bad Request - Missing authentication or invalid request structure

object
error
string
Example
User authentication missing

Unauthorized - Invalid user credentials or session expired

object
error
string
Example
Authentication required

Domain not found or user does not own the specified domain

object
error
string
Example
Domain not found or you do not own this domain.

Validation Error - Invalid input data, business rule violations, or configuration issues

object
One of:
object
success
boolean
message
string
Example
Validation failed.
errors
object

Too Many Requests - Rate limit exceeded. Retry after the specified time.

object
success
boolean
message
string
Example
Too many attempts. Please try again later.
Retry-After
integer

Seconds until rate limit resets

X-RateLimit-Limit
integer

Maximum requests per minute

X-RateLimit-Remaining
integer

Remaining requests in current window

Internal Server Error - Unexpected system error during processing

object
success
boolean
message
string
Example
An error occurred while sending the message. Please try again.