SMTP Relay
HTTP-based SMTP relay. Accepts raw RFC 822 MIME or a simple envelope. Pair with any SMTP-to-HTTP sidecar for true SMTP over TCP.
Endpoint
POST /smtp/send
Scopes: emails:send
Option A — raw MIME
For sidecar proxies that already have a parsed RFC 822 message:
{
"raw": "From: hello@yourdomain.com\r\nTo: user@example.com\r\nSubject: Hi\r\n\r\nHello there"
}Mailgrid parses headers (From, To, Subject, Content-Type) and routes through the standard send() path. All suppression, idempotency, tracking, and stream rules apply.
Option B — JSON envelope
For lighter-weight clients:
{
"envelope": {
"from": "hello@yourdomain.com",
"to": ["user@example.com"],
"subject": "Hi",
"text": "Hello there"
}
}Response
{
"success": true,
"data": {
"smtpCode": 250,
"smtpMessage": "OK 0107019a-...",
"messageId": "0107019a-...",
"status": "sent"
}
}True SMTP over TCP
Cloudflare Workers can't listen on TCP — that's a platform constraint. For legacy clients that need SMTP on port 25 or 587, run a small sidecar that translates SMTP to HTTP POSTs. See the SMTP sidecar guide.