Multiple domains for imap and smtp?

Hi there,

Is there a way to have multiple domains for the box for imap and smtp? I know we can host as many domains as we want, if we set box.mydomain.com in the settings of the email client. Now I want to have mutliple domains here too. Is that possible?

So one has box.mydomain.com in the email settings and the other client users box.otherdomain.com or so.

Thanks,
Martin

No, not really.

You can use a CNAME record to point mail.mydomain.com >> box.mydomain.com or mail.otherdomain.com >> box.mydomain.com BUT this will not work in the sense that it will cause SSL certificate problems in the users email client, so for all intents and purposes, the design of MiaB precludes this.

Though, someone with good scripting skills, COULD do a unsupported modification.

Hi Martin,

It is possible but you have to change the config manually a little bit. Also you have to renew the Let’s encrypt certificate manually. If you’re interested please let me know so that I can post it here.

Hi,

Yes, I’m very interested in this. Please tell me.

Martin

First you have to provision the LE certificate manually. You have to temporary stop Nginx for this.
sudo service nginx stop
sudo letsencrypt certonly --email your@email.address -d mail.domain1.com -d mail.domain2.com -d mail.domain3.com

Then start Nginx again
sudo service nginx start

Then we have to configure Dovecot to use the new certificate
sudo nano /etc/dovecot/conf.d/10-ssl.conf

Change the following lines to:
ssl_cert = </etc/letsencrypt/live/mail.domain1.com/fullchain.pem
ssl_key = </etc/letsencrypt/live/mail.domain1.com/privkey.pem

Save the file and exit nano

Restart dovecot
sudo service dovecot restart

Then we have to configure postfix to use the certificate
sudo nano /etc/postfix/main.cf

smtpd_tls_cert_file = /etc/letsencrypt/live/mail.domain1.com/fullchain.pem
smtpd_tls_key_file = /etc/letsencrypt/live/mail.domain1.com/privkey.pem

Save the file and exit nano

Restart postfix
sudo service postfix restart

You can use now mail.domain1.com, mail.domain2.com and mail.domain3.com without certificates warnings.

In order to refresh the certificate you have to stop nginx, run the letsencrypt command and start nginx again.

1 Like

Two points … the certificate should ALSO have the hostname as one of the domains it covers … and expect this to be overwritten when the version of MiaB is upgraded.

@alento Thanks, will keep that in mind