Sendmail migration: Replicating all incoming mails to another mailserver
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 test@mydomain.com
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
postfix
dovecot
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.
email postfix sendmail
add a comment |
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 test@mydomain.com
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
postfix
dovecot
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.
email postfix sendmail
This isn't so much redirection as replication of incoming emails. Redirection could be handled at the MX level. Replication is harder.
– roaima
Dec 17 at 21:44
add a comment |
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 test@mydomain.com
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
postfix
dovecot
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.
email postfix sendmail
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 test@mydomain.com
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
postfix
dovecot
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.
email postfix sendmail
email postfix sendmail
edited Dec 17 at 22:06
asked Dec 14 at 17:48
rudib
618417
618417
This isn't so much redirection as replication of incoming emails. Redirection could be handled at the MX level. Replication is harder.
– roaima
Dec 17 at 21:44
add a comment |
This isn't so much redirection as replication of incoming emails. Redirection could be handled at the MX level. Replication is harder.
– roaima
Dec 17 at 21:44
This isn't so much redirection as replication of incoming emails. Redirection could be handled at the MX level. Replication is harder.
– roaima
Dec 17 at 21:44
This isn't so much redirection as replication of incoming emails. Redirection could be handled at the MX level. Replication is harder.
– roaima
Dec 17 at 21:44
add a comment |
1 Answer
1
active
oldest
votes
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
echo
getent passwd |
awk -F: '$3>=1000 && $3<65000 {printf "%s: %s, %s@mx2.mydomain.comn", $1, $1, $1}'
) >/etc/aliases
newaliases
I thought of that, but the other server accepts mail underfred@mydomain.com
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 at 22:02
Or would the new server just accept something likefred@mx2.mydomain.com
?
– rudib
Dec 17 at 22:03
If it's set up to acceptmx2.mydomain.com
as an alias for its real target namemydomain.com
yes that should work.
– roaima
Dec 17 at 22:06
I've updated my question with sample mx records to hopefully clarify what I mean by that.
– rudib
Dec 17 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 tomynetworks
in postfix. Many thanks for your patience! :)
– rudib
Dec 17 at 23:25
|
show 5 more comments
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f488034%2fsendmail-migration-replicating-all-incoming-mails-to-another-mailserver%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
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
echo
getent passwd |
awk -F: '$3>=1000 && $3<65000 {printf "%s: %s, %s@mx2.mydomain.comn", $1, $1, $1}'
) >/etc/aliases
newaliases
I thought of that, but the other server accepts mail underfred@mydomain.com
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 at 22:02
Or would the new server just accept something likefred@mx2.mydomain.com
?
– rudib
Dec 17 at 22:03
If it's set up to acceptmx2.mydomain.com
as an alias for its real target namemydomain.com
yes that should work.
– roaima
Dec 17 at 22:06
I've updated my question with sample mx records to hopefully clarify what I mean by that.
– rudib
Dec 17 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 tomynetworks
in postfix. Many thanks for your patience! :)
– rudib
Dec 17 at 23:25
|
show 5 more comments
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
echo
getent passwd |
awk -F: '$3>=1000 && $3<65000 {printf "%s: %s, %s@mx2.mydomain.comn", $1, $1, $1}'
) >/etc/aliases
newaliases
I thought of that, but the other server accepts mail underfred@mydomain.com
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 at 22:02
Or would the new server just accept something likefred@mx2.mydomain.com
?
– rudib
Dec 17 at 22:03
If it's set up to acceptmx2.mydomain.com
as an alias for its real target namemydomain.com
yes that should work.
– roaima
Dec 17 at 22:06
I've updated my question with sample mx records to hopefully clarify what I mean by that.
– rudib
Dec 17 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 tomynetworks
in postfix. Many thanks for your patience! :)
– rudib
Dec 17 at 23:25
|
show 5 more comments
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
echo
getent passwd |
awk -F: '$3>=1000 && $3<65000 {printf "%s: %s, %s@mx2.mydomain.comn", $1, $1, $1}'
) >/etc/aliases
newaliases
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
echo
getent passwd |
awk -F: '$3>=1000 && $3<65000 {printf "%s: %s, %s@mx2.mydomain.comn", $1, $1, $1}'
) >/etc/aliases
newaliases
edited Dec 17 at 22:42
answered Dec 17 at 21:58
roaima
42.8k551116
42.8k551116
I thought of that, but the other server accepts mail underfred@mydomain.com
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 at 22:02
Or would the new server just accept something likefred@mx2.mydomain.com
?
– rudib
Dec 17 at 22:03
If it's set up to acceptmx2.mydomain.com
as an alias for its real target namemydomain.com
yes that should work.
– roaima
Dec 17 at 22:06
I've updated my question with sample mx records to hopefully clarify what I mean by that.
– rudib
Dec 17 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 tomynetworks
in postfix. Many thanks for your patience! :)
– rudib
Dec 17 at 23:25
|
show 5 more comments
I thought of that, but the other server accepts mail underfred@mydomain.com
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 at 22:02
Or would the new server just accept something likefred@mx2.mydomain.com
?
– rudib
Dec 17 at 22:03
If it's set up to acceptmx2.mydomain.com
as an alias for its real target namemydomain.com
yes that should work.
– roaima
Dec 17 at 22:06
I've updated my question with sample mx records to hopefully clarify what I mean by that.
– rudib
Dec 17 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 tomynetworks
in postfix. Many thanks for your patience! :)
– rudib
Dec 17 at 23:25
I thought of that, but the other server accepts mail under
fred@mydomain.com
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 at 22:02
I thought of that, but the other server accepts mail under
fred@mydomain.com
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 at 22:02
Or would the new server just accept something like
fred@mx2.mydomain.com
?– rudib
Dec 17 at 22:03
Or would the new server just accept something like
fred@mx2.mydomain.com
?– rudib
Dec 17 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.– roaima
Dec 17 at 22:06
If it's set up to accept
mx2.mydomain.com
as an alias for its real target name mydomain.com
yes that should work.– roaima
Dec 17 at 22:06
I've updated my question with sample mx records to hopefully clarify what I mean by that.
– rudib
Dec 17 at 22:06
I've updated my question with sample mx records to hopefully clarify what I mean by that.
– rudib
Dec 17 at 22:06
1
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 at 23:25
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 at 23:25
|
show 5 more comments
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f488034%2fsendmail-migration-replicating-all-incoming-mails-to-another-mailserver%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
This isn't so much redirection as replication of incoming emails. Redirection could be handled at the MX level. Replication is harder.
– roaima
Dec 17 at 21:44