"Take over" server / Serveur de disponibilité (secours)

Hello everyone, I am currently experiencing an interesting situation: I have no more internet access (the router is down). So I don’t have access to my emails.

However, I have another server elsewhere. So, I would have liked to know if it was possible for this server to take over if the main server is unavailable.
I am aware that it might be necessary to configure all this, but is it possible? And if yes, how (simplest method)?

Thanks a lot!!!

Bonjour à tous, je vis actuellement une situation intéressante : je n’ai plus d’accès internet (le routeur est HS). Donc je n’ai plus accès à mes emails.

Or, je dispose d’un autre serveur ailleurs. Alors, j’aurais aimé savoir s’il était possible pour ce 2ème serveur de lui permettre de reprendre la main en cas d’indisponibilité du serveur principal (et assurer un service d’email de secours par exemple).
J’ai bien conscience qu’il faudrait peut-être configurer tout cela, mais déjà, est-ce possible ? Et si oui, comment (méthode la plus simple) ?

Merci beaucoup !!!

Servers 1 & 2 : x86_64
Yunohost : version 11 stable

When your mail server is unavailable you have 4 or 5 days to make it reachable before your unreceive email are just dropped by others server.

You can create a secondary MX server in order to receive email on this secondary server when the first is down. However, you need to make some manual change on the postfix configuration to do it

1 Like

You can find what you need to change on this Pull Request:


Thank you very much, I really wonder why the feature has not been incorporated into Yunohost because it would nicely help to solve a typical self-hosting issue.

Please, how am I supposed to use this commit?
I see several changes in some postfix files (e.g. data/hooks/conf_regen/19-postfix, data/templates/postfix/main.cf, etc.) :

  1. should I add the new lines in my postfix files as mentioned in the commit?
  2. if I change these lines, will they persist after an update?
  3. in the Conversation tab, it is mentioned :

How to test :

yunohost settings set 'smtp.backup_mx.domains' -v "domain2.tld,domain3.tld"
yunohost settings set 'smtp.backup_mx.emails_whitelisted' -v >"camille@domain2.tld,fred@domain3.tld"
cat /etc/postfix/relay_recipients
cat /etc/postfix/main.cf

→ are those above commands that I have to run after changing the postfix files (I mean, are they just dry test commands or “run/validation” commands)?

Thank you so much again !

EDIT : I did not know that you & zamentur are the same person !

Sorry to insist but my server is still down, I need to check important emails, so please feel free to help me.
Thank you very much and sorry for the reminder !

Sorry again, but I really really really insist.
Yunohost is a great project, but self-hosting forces you to have plans B. @ljf answer is a hope and I just ask to answer to my questions.
From my side, I could eventually test and tell if it works. I’d rather do that than continue without a mailbox or go back to an email provider that collects data.
Thank you again for your kind help

Please, any news ?

If I understand correctly, your Yunonhost server (at home?) is cut off from the global internet because of your router being down, right? If this is the case then any change in Yunohost will be useless anyway. You could use temporarily a 4G modem/router and restore your server?

If your other server is located elsewhere then you need to go to your domains DNS settings and change MX record pointing towards your other server.

1 Like

Thank you very much for your reply. Yes the server was down due to the router. The router has been replaced and I can connect to the server, but I remember it as an unpleasant experience.

@ljf proposed a very good idea allowing to modify postfix files, but before proceeding to the modifications (because it can have problematic consequences), I asked for confirmations unfortunately without return. So I didn’t modify anything.

My domain provider being OVH, would you suggest me to modify the domain DNS settings by changing the MX records directly on my user space at OVH?
Is there a tutorial somewhere to do this please? Thanks a lot for your help!

Yes, you can set multiple MX records with priority levels. There can be only one used at any given time, but the principle is that if one fails to respond then requests will be redirected towards the next one in priority order (in reality I think it’s a bit more complicated).
I like Unixsheikh clear introduction about DNS, or this simple article on Gandi. Then domain name providers have instructions, like here.

1 Like

Thank you very much for your kind feedback and especially the links. I have tried to contact OVH forum (my domain provider that I want to use for both Yunohost servers) about how to set it up and… it is still unclear (especially a debate about how to use domain name) :

According to the member reply, it is OK to change from this :

to that :

However there is still 2 questions remaining :

  1. If I choose in the domainB.ovh entry, how can OVH know the exact email of Yunohost to which to forward the email (knowing that there are several email accounts per Yunohost server, ex: jonathan@domainB.ovh, jennifer@domainB.ovh, etc. )
  2. Shall I set up the MX entries on the second server ? If yes, what exactly to change ?

I’ve been looking for about 15 days, it looks really complicated

It’s very confusing but it’s not that complicated. Let’s do things in order.
A) different domains
domainA.ovh and domainB.ovh are different domains so they should have separate DNS entries (your A, MX records…). Imagine another computer somewhere on the planet asking “I want to send an email to Jonny@domainA.ovh, where do I send that?”, there has to be an answer specific to domainA.ovh.
B) MX records
For email the MX record will provide the information “where to send that email”
Your question about “Domain” (on the left) - for MX you just leave domainA.ovh then the “Target” will be again domainA.ovh for which you define an A record that will provide the IP address.
If you want a backup email server, then you add a second MX record for “Domain” domainA.ovh, with higher priority number (say, 50) and another “Target”, for example mailbackup.domainA.ovh. You need to have created a A record for mailbackup.domainA.ovh pointing to the IP address of that server.
Note that there should be only one (or two) MX records for a given domain (unless you are Google), so I don’t understand why you have so many MX records? I don’t think this is correct.
C) Different users
Emails for jonathan@domainA.ovh and jennifer@domainA.ovh will end up on the same email server. There is nothing to do with DNS. The email software is designed to manage different users.

1 Like

Hello, I have found a workaround as I have 2 servers, both on OVH provider, I have used their “mail forwarding feature” :

By using the clone schema (case #2 on above image), I have forwared :

  • on domainA account : email@domainA.ovh -> email@domainB.ovh (with keepcopy on OVH option)
  • on domainB account : email@domainB.ovh -> email@domainA.ovh (with keepcopy on OVH option)

Thus, I hope emails shall be replicated and in case of a domain failure, I hope to get a backup domain to receive my emails.