How to keep your mailbox outside yunohost

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


query_filter = (&(objectClass=mailDomain)(virtualdomain=%s))


query_filter = (&(objectClass=mailDomain)(!(virtualdomain=YOURDOMAIN.TLD))(virtualdomain=%s))

in /etc/postfix/

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 :


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.


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.

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

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

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


@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.

does the proposed solution still works with yunohost settings ?
I’m ending up with ‘loops back to myself’ when proceeding as described.

I have Yunohost installed on a small Kimsufi server.
I have turn off services Dovecot, Metronome, Postfix, rspamd because I don’t want my Yunohost server to manage Email and XMPP.
Email is managed by my registar / DNS provider. And I do as @scith said with an A field targetted to Yunohost server in my Zone DNS.

But so I can’t receive any Yunohost system Email alert.
I am in the same situation as @djib where I would like to receive the email sent to root, admin and my users, even if these Email address are not managed by Yunohost.

Do you know if this is possible ? What I should do to achieve this?
(sorry to revive this old unsolved topic…)

I want tot do the same : I want my yunohost server to be able to send email (to an external server) bot not receive them.

Instead of modifying the config files, what if I disable postfix?

   service postfix stop
   service postfix disable

and dovecot ?

I have already commented the “mx-host” line in /etc/dnsmasq.d/DOMAINS.conf instead of changing them and I get the correct MX servers with dig :slight_smile: