This tuto is here to help you to configure your yunohost to be able to keep your mailbox @YOURDOMAIN.TLD on your registrar and to be able to send email to all adresses even the yours in @YOURDOMAIN.TLD.
Yunohost configure postfix, your server mail, to work as a mailbox manager. But in your case you just want send mail but not receive them.
So when you try to send a mail from your yunohost server to your mail address with the same domain name, your yunohost try to send the mail to itself and say something as
Recipient address rejected: User unknown in virtual mailbox table;
So we need to configure the system to avoid to manage mailbox. Here are the step I have done:
Stop managing mailbox for this domain
query_filter = (&(objectClass=mailDomain)(virtualdomain=%s))
query_filter = (&(objectClass=mailDomain)(!(virtualdomain=YOURDOMAIN.TLD))(virtualdomain=%s))
And restart postfix
service postfix restart
Change dnsmasq specific rules
dnsmasq is used in YunoHost to change some DNS answer to allow some apps to setup correctly even if the yunohost admin hasn’t configure properly the DNS on the registrar interface.
In our case, it’s quite embarassing, cause of the MX is forced to be the yunohost server !
To change that, edit /etc/dnsmasq.d/YOURDOMAIN.conf and fill with the correct MX server:
To get the correct MX server, use dig :
dig MX YOURDOMAIN.TLD @126.96.36.199