MailSetu
REST API v1 llms.txt

Send transactional email through your own SMTP

Make one HTTPS POST request per message. Your SMTP credentials stay encrypted on MailSetu and are never exposed to your application.

POST https://equivalent-alisa-spideyofficial777-c749c4c7.apps.mistral.run/v1/emails/send
  1. 1
    Connect SMTP

    Add your server on SMTP accounts and test the connection.

  2. 2
    Create API key

    Generate a bearer key on API keys (shown once).

  3. 3
    Send via REST

    Call POST /v1/emails/send with JSON.

Interactive playground

Send a real test email or generate a live cURL snippet from your inputs.

Live
Sign in to send live test emails

The full API reference below is public. Sign in or create an account to test directly against your SMTP servers.

Authentication

Send your API key as a bearer token. Keys look like ms_live_…. Keep them on your backend and never expose them in browser code.

Header
Authorization: Bearer ms_live_YOUR_API_KEY

Requests without a valid key, or using a revoked or expired key, return 401.

SMTP configuration

Each account stores the fields below. Passwords are encrypted with AES-256-GCM at rest and never displayed again.

SMTP account fields
FieldDescription
hostYour provider's SMTP server, for example smtp.gmail.com.
port465 with SSL/TLS, or 587 with STARTTLS.
securityssl (implicit TLS) or starttls.
username & passwordProvider SMTP credentials. Gmail and Outlook usually require an app password.
sender_emailThe only address allowed as from. Requests with another address are rejected.

Send email

Provide html, text, or both. Limits: up to 50 recipients across to, cc, and bcc, and up to 10 MB of attachments per request (120 sends/min per key).

Request fields
FieldTypeRequiredNotes
smtp_idintegerYesID of one of your SMTP accounts.
fromstringYesMust equal the account's sender_email.
toarray or stringYesAt least one address.
cc, bccarrayNoOptional recipients.
subjectstringYesUp to 998 characters.
html, textstringOne ofYour own message body.
attachmentsarrayNoObjects with filename, content_type, and base64 content_base64.
webhook_urlstringNoOptional HTTPS URL to receive automatic email.sent / email.failed events.

Batch / Bulk send

Send up to 50 personalized emails in a single request using {{ variable }} placeholders.

POST /v1/emails/batch
Batch JSON payload
{
  "smtp_id": 1,
  "from": "you@yourdomain.com",
  "subject": "Hello {{ '{{name}}' }}, order #{{ '{{order_id}}' }}",
  "html": "<p>Hi {{ '{{name}}' }}, your order <b>#{{ '{{order_id}}' }}</b> is confirmed.</p>",
  "messages": [
    {"to": ["alice@example.com"], "variables": {"name": "Alice", "order_id": "1041"}},
    {"to": ["bob@example.com"], "variables": {"name": "Bob", "order_id": "1042"}}
  ]
}

SDK examples

Replace YOUR_API_KEY with your key. Sample uses SMTP account 1 and sender you@yourdomain.com.

cURL
curl -X POST https://equivalent-alisa-spideyofficial777-c749c4c7.apps.mistral.run/v1/emails/send \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "smtp_id": 1,
    "from": "you@yourdomain.com",
    "to": ["customer@example.com"],
    "subject": "Your order has shipped",
    "text": "Your order is on its way.",
    "html": "<p>Your order is on its way.</p>"
  }'

Responses

A 200 means your SMTP server accepted the message. It does not confirm inbox delivery.

200 OK
{
  "status": "accepted_by_smtp",
  "message_id": "<7f3a…@yourdomain.com>",
  "note": "The SMTP server accepted the message. Inbox delivery is not guaranteed."
}
502 Bad Gateway
{
  "status": "failed",
  "error": "Authentication failed. Check the SMTP username and password."
}

Error codes

API error codes
CodeMeaningWhat to do
401Missing, invalid, revoked, or expired API key.Check the header format and key status.
403The account is blocked or not verified.Verify your email or contact support.
404SMTP account does not exist or belongs to another user.Check smtp_id.
413Attachments exceed the 10 MB limit.Send smaller files or links.
422Validation failed (e.g. from mismatch).Read the error field and fix the payload.
429Too many requests for this key.Back off and retry shortly.
502SMTP server rejected the send or could not be reached.Test the account on the SMTP page, then retry.