Once your Custom SMTP provider and IP Pool are configured, you send emails through your SMTP server using the same SendPost API as for other providers. You must include the ippool parameter so traffic is routed to your Custom SMTP TPSP.
Important: You must include the ippool parameter in your API request to route emails through your Custom SMTP server.
SendPost prepares each message (DKIM, open pixel, click rewrites, unsubscribe headers, Return-Path, and SendPost metadata headers) and relays it over SMTP to your server. Your MTA receives a fully-formed, ready-to-deliver message.
Return path domain: A verified return path domain is required for the sender domain. If none is configured, the message is not retried and SendPost emits CSDropped with reason “No verified return path domain configured for sender domain”.
Basic Email Example
curl -X POST "https://api.sendpost.io/api/v1/subaccount/email/" \
-H "X-SubAccount-ApiKey: YOUR_SENDPOST_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"from": {
"email": "sender@yourdomain.com",
"name": "Your Name"
},
"to": [{
"email": "recipient@example.com",
"name": "Recipient Name"
}],
"subject": "Hello from SendPost via Custom SMTP",
"htmlBody": "<h1>Hello!</h1><p>This email is relayed through your SMTP server.</p>",
"textBody": "Hello! This email is relayed through your SMTP server.",
"ippool": "custom-smtp-pool",
"trackOpens": true,
"trackClicks": true
}'
Message Preparation (No Changes on Your Side)
SendPost builds the message the same way as for its own infrastructure:
- DKIM: Signed with your verified domain keys (when applicable)
- Open tracking: Pixel pointing to SendPost
/track/tpsp/open/... (events attributed as CSOpen)
- Click tracking: Links rewritten to SendPost
/track/tpsp/click/... (events attributed as CSClick)
- Unsubscribe: Headers/links to SendPost
/track/tpsp/unsubscribe/... (events attributed as CSUnsubscribe)
- Return-Path:
bounces+{messageUUID}+{subAccountId}@sp-bounce.{verified-domain} (reuses your existing bounce domain)
- Headers: Including
X-Sendpost-Message-UUID, X-Sendpost-Account-ID, X-Sendpost-SubAccount-ID, X-Sendpost-TPSP-ID, X-Sendpost-TPSP-Type, and others used for correlation and bounce attribution
Your Postfix (or other MTA) can deliver the message as-is. The event reporting agent uses these headers to correlate log entries to SendPost messages.
Response
Success Response (HTTP 200):
[
{
"messageId": "abc123-def456-ghi789",
"errorCode": 0,
"to": "recipient@example.com"
}
]
Relay to your SMTP server may still fail after accept (e.g., connection timeout, 4xx/5xx). SendPost retries up to 5 times with linear backoff. On success, you get CSSent when your MTA returns 2xx; CSDropped only if all retries fail.
Next Steps