How to keep your mailbox outside yunohost


#1

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

External SMTP relay server for the domain
#2

Thanks, that’s very useful.

I think there should be an option in Yonohost to have email managed by an external provider on the main domain. I’m happy to host my own apps (Nextcloud, Rainloop, Dokuwiki…), but hosting my own email feels like too much responsibility for me.


#3

This can be achieved by any web application that support IMAP. I think there is one plugin IMAP to connect to any other email provider. You all together don’t need any settings for this.


#4

Well, I’m not talking about client configuration but server configuration. Let’s pretend my email is hosted by OVH on mydomain.com. I’m happy to have yunohost manage apps hosted at mydomain.com, but want to leave email management to OVH.

I might end up using this solution, with my apps hosted on a subdomain.


#5

Its possible
Leave the DNS as is (the MX) for the emails to be managed by OVH. Redirect domain.com to your server IP with a A field.
Add domain.com to yunohost. Create your users and give them email@domain.com corresponding to the OVH emails.
Install rainloop. In the admin interface, change the IMAP/SMTP of domain.com to correspond to the OVH settings.
Done


#6

@scith, I’m sorry your solution does not fit my need.
I need my yunohost server to be able to send email to my OVH email (basically all mail addressed to root, admin, and my user). Adding my OVH domain to Yunohost automatically creates a MX record for that domain, and thus creates a dead loop.

@ljf’s solution against that dead loop works fine.