Skip to main content
mailers.io

Routing and failover

Failover between two providers in mailers.io

By mailers.io team Published 5 min read

One provider is one point of failure. Accounts get paused, keys expire, regions have bad hours, and a provider can refuse your traffic for a reason that has nothing to do with the message. If a single account carries all your mail, all your mail waits when it stops. This post shows how to use two providers in mailers.io so that one failing does not stop sending, and how to prove that it works.

What you get on every plan

Every account has a default routing rule, created when you connect your first server. It does three things:

  • Round robin. Mail is spread over your active servers, with the one used least recently going first.
  • Three attempts. A message can be tried on up to three servers, and never the same server twice.
  • Failover. When a server fails in a way that is the server’s problem, the message moves to the next one.

That is all you need for two providers. You do not configure anything, and the rule cannot be turned off by accident.

Custom rules are different. Choosing a server by priority or weight, filtering by recipient, or capping a server on top of its speed limit are not part of any current plan. Do not plan around them. If you want one provider to carry less, give it a lower speed limit or daily cap. The details are in routing by provider quota and speed limits.

Step 1: pick two providers that fail differently

Two accounts at the same provider fail together when the provider has a problem. Two different providers do not. Any pair you can connect works, for example Amazon SES and SendGrid, or Mailgun and Brevo. A Gmail or Microsoft 365 mailbox can be one of the servers, but their daily limits are set by Google and Microsoft and are much lower than a bulk provider’s, so use them as a small extra, not as the second half of a large send. The setup of one provider is in connecting Amazon SES.

Step 2: get both ready to send as you

This is the step people skip, and it is the one that makes failover fail when you need it. Each provider needs to accept mail from your sending domain:

  • Verify the domain or address at the provider, as it requires.
  • Publish its authentication records, meaning its DKIM keys, and make sure your SPF record includes it. A message that goes out through the second provider must still pass SPF or DKIM aligned with your domain.
  • Check the account’s state. A new account may be in a sandbox with strict limits until the provider approves it. A spare in a sandbox is not a spare.
  • Give it some traffic. A provider you have never used has no reputation with you. Spread mail across both from the start, even in small amounts, so that the second one is not cold when it has to take over.

A failed failover usually is not a mailers.io problem. It is a second provider that was never ready.

Step 3: connect both and set limits

Add both as sending servers. mailers.io tests the connection when you save credentials, and credentials are stored sealed and cannot be read back. For each server, set:

  • A speed limit a little under what the provider allows, so there is room for anything else that uses the same account.
  • A daily cap that fits the provider’s quota, or lower for a new account.

Limits are counted per server, and you set them, because mailers.io does not read them from the provider. Together they define the capacity of your setup. If one server fails, the other has to carry the load within its own limit, so check that one server’s limit can cover the volume you cannot afford to delay. See daily limits per mailbox and server.

What counts as a failure

When the handover to a server fails, the error is classified before anything is retried.

  • A server fault means the server or the account has a problem: the connection is refused, the credentials are rejected, the provider says the account is paused, a permission is missing or you hit a rate limit. The message moves on to a different server.
  • A recipient fault is a bad address or a rejected mailbox. It is not tried elsewhere, because it would fail the same way and each try costs reputation.
  • A content fault is a message the provider refuses as written. Another provider will not change that.
  • An unknown fault that cannot be classified does not fail over either.

For a provider that answers with a rate-limit error, that server is also put aside for the time it asks for, or for a minute when it does not say, while the other carries the mail.

What you will see when a server keeps failing

After five server-fault attempts in a row on the same server, mailers.io raises a “server failing” notice. It names the server, says when it started failing, gives the reason in plain words and says what to check. A single successful send clears it. The notice reaches the notification centre and e-mail, so someone learns about it without watching the log.

Step 4: test failover before you need it

Do not wait for a real outage.

  1. Send a small batch to your own addresses and open the message log. Both servers should appear.
  2. Break one on purpose. In a quiet moment, replace the credentials of one server with a wrong value, or remove its permission at the provider, and save. Do not do this on a production account at a busy time.
  3. Send another batch. Mail should still arrive. In the log, the attempts show the failed server and the one that took the message.
  4. Restore the credentials and send again to confirm both are back in the rotation.

If step 3 fails, the log tells you which server could not take the mail and why, and you have found the gap while it was cheap to find.

What failover does not do

  • It does not fix a bad list. A recipient fault is never moved to another provider.
  • It does not merge reputation. Each provider and domain has its own.
  • It does not guarantee delivery to the inbox.
  • It does not create capacity. If both servers are full, the message waits until a limit reopens.
  • It does not let you pick a main and a spare. The default rotation uses both all the time, which also keeps both warm.

A summary

Two providers, both authenticated for your domain, both with sensible limits, both used every day. The default rule does the rest. For the reasoning behind this, read why one provider is a single point of failure, and see e-mail routing for the whole feature.

Questions and answers

Do I need to write a routing rule?

No. The default rule is created with your first server: round robin across your servers, three attempts, failover to the next server.

Can I make one provider the main one and the other a spare?

Not with a current plan. Priority and weights belong to custom routing rules, which are not part of any plan today. The default rule rotates between your servers.

Will a message be delivered twice?

A message is handed to one server at a time and moves on only when a server fault says it was not accepted. Each attempt is recorded in the message log.

Written by the mailers.io team. Published .

Keep reading

Related posts

Send cold e-mail from your own servers.

Connect your servers, import a list and write the steps. Replies stop the sequence.

  • 7-day money-back guarantee
  • Bring your own providers
  • Cancel anytime