I am migrating a mailserver running sendmail 8.14.3 to a postfix server. The MDA on the new server is Dovecot. In order to ensure a seamless transition, it would be best if incoming mails are delivered to both servers simultaneously.

I've heard about the SMART_HOST and nullcient options in sendmail, but I'm not sure if this works in the way I need it to. What I need is all incoming mails also delivered to the new server, leaving the existing configuration untouched, as they should be delivered to the mailboxes on the old server as well.

Mails are sent to an address like [email protected] and should be delivered to mx1.mydomain.com (old) and mx2.mydomain.com (new). So mx1 should forward a copy to mx2.

Dual MX Records are not enough as the one server would only be contacted when the other one isn't reachable - while both should be receiving the mail.

Maybe another option would be to configure sendmail to deliver directly to Dovecot on the new server via lmtp? Or maybe just rsync the mailboxes on the two servers. But I'm not sure if that's compatible.

UPDATE: It's not the same format: on the old server, there are just plain old files for each mailbox, while Dovecot creates a cur, new tmp structure in each user's mail directory. However, in the end, files with a similar format reside in those directories. The speration string is different though. Maybe it's possible to translate the old format and copy it to the new server periodically? Would that somehow interfere with Dovecot? And where could I place the copies on the new server so that Dovecot won't be affected while still recognising them?

I hope there is some kind of workaround for that.

System Indormation

Number of mailboxes: ~100-200

Old Server:

OS: Debian GNU/Linux 6.0
sendmail 8.14.3
mails are delivered to "real"/"passwd" users
Other Serives: apache2, mysql, other miscellaneous

New Server:

OS: Debian GNU/Linux 9
mails are delivered to virtual users/SQL
Other services: apache2, mysql, other miscellaneous

Current MX entry for reference:

mydomain.com.    IN      MX      0 mx1.mydomain.com.
mydomain.com.    IN      MX      1 mx2.mydomain.com.
  • This isn't so much redirection as replication of incoming emails. Redirection could be handled at the MX level. Replication is harder. Dec 17, 2018 at 21:44

1 Answer 1


I can't test this right now but I'm fairly sure sendmail understands entries in /etc/aliases of the form

fred: fred, fred@otherserver

(If it goes into a mad loop, prefix the second fred with a backslash \.)

Then it's a straightforward extract from /etc/passwd into the aliases file. And remember to run newaliases (?) to update the internal sendmail database.

Here is an example snippet to generate the lines that would be appended. It considers only users whose UID is in the range { 1000 ≤ uid < 65000 }.

[ ! -f /etc/aliases.save ] && cp -p /etc/aliases /etc/aliases.save

    cat /etc/aliases.save
    getent passwd |
        awk -F: '$3>=1000 && $3<65000 {printf "%s: %s, %[email protected]\n", $1, $1, $1}'
) >/etc/aliases

  • I thought of that, but the other server accepts mail under [email protected] only (the same as the old server as the addresses are supposed to stay the same). So could I somehow remap that on the new server?
    – rudib
    Dec 17, 2018 at 22:02
  • Or would the new server just accept something like [email protected]?
    – rudib
    Dec 17, 2018 at 22:03
  • If it's set up to accept mx2.mydomain.com as an alias for its real target name mydomain.com yes that should work. Dec 17, 2018 at 22:06
  • I've updated my question with sample mx records to hopefully clarify what I mean by that.
    – rudib
    Dec 17, 2018 at 22:06
  • 1
    I think it's working properly now. The old sendmail server may be a bit misconfigured. I've added the old server's ip to mynetworks in postfix. Many thanks for your patience! :)
    – rudib
    Dec 17, 2018 at 23:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .