respecting MX priority


New Email

I have a server that is and was serving well with qmail for years. Now one of the domains we're hosting on it is moving to Office 365, and so the updated DNS entries are like

# host -t mx mail is handled by 0 mail is handled by 5

The idea is that, for a while, in order to make the migration smoothly, the current server should [continue to] work as a back-up server.

For e-mail sent from wherever in The Internet, things are fine, _except_ for mails sent from within our LAN, for which - you guessed - is as well the company SMTP server.

So mails sent from within the company are hitting the server and ... are delivered locally.

Is there a way to make qmail try at first the external, higher priority MX, and deliver locally only if that one doesn't work?

Many thanks in advance.


EQ Forum Admin
Staff member
I'd remove the domain from your local server. You don't need it to be a backup. Let the sending mail servers handle retrying delivery at their preferred intervals if for some reason Office 365 goes down.

In addition to the problem above, there will be others on the internet delivering to your server due to misc network issues. Combine that with spammers trying your MX first as a way to get email past the Office 365 spam/reputation filtering, it will cause the customer to get more spam if you do setup yourself as a backup-mx server.

If you insist, qmail had a program called serialmail that I believe can be used to take locally delivered email and resend it to Office 365.

I think the best experience for your customer will be to remove your server from their MX records and then remove their domain from your server.


New Email
Thank you. I followed your advice and just abandoned the idea with the backup MX on the same server - which seems not only a bad idea, but probably just cannot be done the way the plan was.