Routing and failover
Mixing API and SMTP providers in one sending setup
By mailers.io team Published 5 min read
public/media/blog-mix-api-and-smtp-providers-cover.webp Most teams start with one provider and add a second later. The second one is often of a different kind: an API provider next to a mailbox, or an old SMTP relay next to a new account. mailers.io lets you mix them. This post explains what is the same for all servers, what is different, and how to avoid the surprises that come from the differences.
Three ways to connect a server
mailers.io supports eleven kinds of sending server. They fall into three groups:
- API providers. Amazon SES, SendGrid, Mailgun, Postmark, SparkPost, Brevo, Elastic Email and ZeptoMail. You give the app an API key (for SES, an access key and secret). mailers.io hands the message to the provider over HTTPS.
- Mailbox APIs over OAuth. Gmail and Microsoft 365 (Outlook). You sign in once and grant permission to send. No password is stored.
- Generic SMTP. Any server with a host, port, security mode, user name and password. This covers a relay you already run, a hosting account or a provider we have no driver for.
Regions are part of the form where a provider has them. SES has many, SendGrid and Mailgun have a US and an EU choice, SparkPost has US and EU, ZeptoMail has US, EU and India.
What is the same for every type
Once a server is connected, the sender treats them alike.
- One rotation. The default rule, created with your first server, rotates round robin across your active servers and fails over to the next one when a send fails. It applies on every plan. See routing by provider quota and speed limits.
- The same limits. Each server can have a speed limit and a daily cap, whatever its type.
- The same credit. One credit is used per message sent, from any server.
- The same log. The message log shows each attempt with the server and the answer.
- The same suppression list. A hard bounce or a complaint suppresses the address account-wide, so the next send to it is skipped from any server.
That is the benefit of the mix: you get one place to set limits and read results, even though the connections underneath are different.
What is different
Who signs the message with DKIM
For a plain SMTP server, mailers.io signs the message itself with the DKIM key of your sending domain. For an API provider, the provider signs it. In both cases you publish DNS records for the domain, but the records are not the same, and an API provider also needs your domain registered on its side.
mailers.io registers the domain at the provider for SES, SendGrid, Mailgun, Postmark, SparkPost, Elastic Email and Brevo. ZeptoMail has no registration call, so that step is manual. A server of an API type is not used for a message until its provider has confirmed the From domain. A plain SMTP server is never checked this way, so it can send before you have done anything at the provider, and that is a trap: it may deliver mail the other servers would hold back. Add the domain in sending domains and confirm it everywhere before you rely on the rotation. The post on adding a sending domain walks through it.
How bounces come back
A provider that has an API usually reports bounces and complaints itself, through a webhook that mailers.io registers or that you set up once. Details vary: SES uses a notification topic that is set up for the server, SendGrid and Mailgun sign their events, SparkPost and Elastic Email use a secret URL, and ZeptoMail needs the webhook added by hand.
A plain SMTP server gives less. It reports some failures at once, when the receiving server refuses a recipient during the conversation. Failures that come later, as a returned message, reach mailers.io only if you connect a bounce mailbox over IMAP. Gmail and Microsoft 365 mailboxes also rely on that route. Without it, those servers still send, but late bounces are missed and your list gets no feedback.
If you mix types, check each one: send a test to an address that does not exist and see that the bounce appears in the log.
How errors are reported
An SMTP server answers with a numeric reply. An API provider answers with an HTTP status and its own error text. To keep the failover rules the same, the app translates both into the same classes: a fault of the server, of the recipient, of the content or an unknown one. Only a server fault moves the message to another server. The next post, per-send retries and hard provider errors, goes through the classes.
An API provider also has errors that SMTP never has, such as a paused account, a missing permission or a rate limit. These are treated as server faults, so the message goes elsewhere. A provider that asks you to slow down is put to sleep for the time it names.
Limits that belong to the provider
Your speed limit and daily cap are yours. The provider has its own, and they do not always match. For Gmail and Microsoft 365 mailboxes, the daily and per-minute limits set by Google and Microsoft apply, and a trial account is held lower than a paid one. Set your limits below the provider’s.
Rules for a good mix
- Pick the type for the job. Use an API provider for volume, where signed events and fast hand-over matter. Use mailboxes for low-volume, personal-looking mail. Use SMTP for a relay you already trust.
- Mind the sequence rule. Postmark does not allow cold e-mail, so a Postmark server is refused for sequences. See why Postmark refused cold e-mail. Check the terms of every provider you mix in before you use it for outreach.
- Give every server a limit. A mix with one unlimited SMTP server and one capped API server sends most of its mail through the unlimited one.
- Wait for domain confirmation on the API servers before you add them to a live rotation.
- Connect a bounce route for every server that has no webhook.
- Test each server separately. Use the test mail on the server’s page, which goes through that server only, and read the result in the log.
What a mix does not do
It does not give you control of the split. The default rule is round robin, so with equal limits each server takes a similar share. Custom routing rules, with weights or priority, are not part of current plans. To give one server a smaller share, give it a smaller limit.
It also does not turn two weak setups into a good one. If your list is poor, a mix means more places where it is noticed. Failover protects you from server trouble, not from bad data.
The page on sending servers lists the supported types, and e-mail routing shows how the rotation fits in.
Questions and answers
Do API servers and SMTP servers share one rotation?
Yes. The default rule rotates round robin across all your active servers, whatever their type, and fails over to the next one when a send fails.
Does a message cost more credits on one type than on another?
No. A message uses one credit when it is sent, whichever server takes it.
Can I use Gmail or Microsoft 365 mailboxes next to an API provider?
Yes. They connect with OAuth and join the same rotation. They keep the daily limits that Google and Microsoft set.
Written by the mailers.io team. Published .