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.
The problem
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;
The solution
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
Replace
query_filter = (&(objectClass=mailDomain)(virtualdomain=%s))
by
query_filter = (&(objectClass=mailDomain)(!(virtualdomain=YOURDOMAIN.TLD))(virtualdomain=%s))
in /etc/postfix/ldap-domains.cf
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:
address=/YOURDOMAIN.TLD/AA.BB.CC.DD
mx-host=YOURDOMAIN.TLD,THECORRECTMX.TLD,5
srv-host=_xmpp-client._tcp.YOURDOMAIN.TLD,YOURDOMAIN.TLD,5222,0,5
srv-host=_xmpp-server._tcp.YOURDOMAIN.TLD,YOURDOMAIN.TLD,5269,0,5
To get the correct MX server, use dig :
dig MX YOURDOMAIN.TLD @9.9.9.9