I have a VPS with a few domains: domain1.com, domain2.com

FQDN = domain1.com

A self signed certificate for FQDN is configured automatically.

iRedMail (postfix + dovecot) is configured on this VPS. IMAP STARTTLS, mail servers (both imap, smtp) are the same domains (without mail.* subdomain).

When I'm trying to authenticate get the mail from domain1.com it works well. But when I'm trying to retrieve mail for domain2.com, I'm getting error that server name and email address domain differ (mail@domain2.com -> FQDN domain1.com).

How to solve this correctly? Can I create self-signed multiple domains certificate? Or how can I configure postfix/dovecot to correctly process multiple domains?


  1. I'm not able to send mail from clients. But can do that from web site (domain's website)

  2. I'm able to receive mail from any domain (was able to configure only for Android) in case I'm using STARTTLS + Accept all certificates

2 Answers 2


You have to create another self signed certificate for the other domains and use it with the server.

local_name imap.example.org {
  ssl_cert = </etc/ssl/certs/imap.example.org.crt
  ssl_key = </etc/ssl/private/imap.example.org.key
local_name imap.example2.org {
  ssl_cert = </etc/ssl/certs/imap.example2.org.crt
  ssl_key = </etc/ssl/private/imap.example2.org.key
# ..etc..

It is important to note that having multiple SSL certificates per IP will not be compatible with all clients

Example : Multiple SSL certificates, With client TLS SNI (Server Name Indication) support


This can easily work well as long as you decide on one principal domain, domain1.com. Configure mail clients that read mail@domain2.com to use server domain1.com for reading and sending mail, and everything should be OK.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.