I am migrating a domain from external IMAP to Mailcow Dockerized but I need to do it incrementally. So, I am trying to setup Split Domain Routing and I need help as I have not been able to make it work. Here is what I have:
Domain: mydomain.com
Server1: Current SMTP/IMAP server; MX records for mydomain.com point here
Mailcow1: New server. Has mydomain.com as a regular domain and mydomain.helperdomain.com as an alias to mydomain.com. MX records for mydomain.helperdomain.com point here.
Mailboxes: [email protected] and [email protected]
I want to move [email protected] to Mailcow1 so I have the following redirection: [email protected] -> [email protected] on Server1 and a regular mailbox on Mailcow1.
I have been playing with Postfix transport_maps and I have been able to send/receive from the Internet (other domains) without a problem. After playing a lot trying to trick Postfix and creating a local Mailcow1 account for [email protected] I have been able to send from bob to Jane, but I have not been able to send from Jane to Bob no matter what.
I guess that I may have to play with the sql files but I鈥檓 not sure where to begin. Can anyone direct me to the right path? The only changes that I have from a current stock Mailcow Dockerized are:
main.cf:
transport_maps = hash:/opt/postfix/conf/transport
/opt/mailcow-dockerized/data/conf/transport:
[email protected] smtp:[mail. mydomain.com]:25
[email protected] :
Thank you.
//catcun
Hi,
Just to be sure: You postmap'ed the transport map?
Can you show me the output of docker-compose logs --tail=300 postfix-mailcow after trying to send a mail which does not route correctly?
Hello,
Yes, I created the hash database with postmap. I had to use docker-compose exec postfix-mailcow postconf -e "transport_maps = hash:/opt/postfix/conf/transport" instead to edit main.cf as postfix was not loading the changes when editing, at least postconf -n didn鈥檛 reflect them.
By the way, there is only one mailbox in Mai.cow: [email protected]
Anyway, here are the anonymized logs:
Just to clarify, Jane is using the original e-mail server and can not send to Bob on the Mailcow server?
If the above statement is correct then I don't think setting up transport maps on Mailcow will be able to solve your problem. The postfix manual says transport maps are only for determining the outgoing transport. You will need to set up transport maps on the original server (where Jane's account is located) in order to send to Bob on Mailcow1.
I'm working out a migration path to Mailcow right now as well. I am using transport_maps on mailcow to direct mail from users on mailcow to users on our old e-mail server. For users that are migrated to Mailcow I use Fetchmail to pull their e-mails from their inbox on the old server in to their Mailcow account. It isn't instant, but it is a bit simpler. You could also use GetMail for pulling e-mail from one server in to the local server.
While testing I added the field transport to the mailbox table in order to hold transport information. Added this line transport_maps = proxy:mysql:/opt/postfix/conf/sql/mysql_transport_maps.cf to main.cf, and this is my mysql_transport_maps.cf file:
user = mailcow
password = password
hosts = mysql
dbname = mailcow
query = SELECT transport FROM mailbox WHERE username='%s';
I haven't run in to any problems in the past day. If there is interest I can flesh out the implementation and submit a pull request.
Hello,
Jane is on Mailenable (ME) who holds the MX records and Bob is on ME as a forward to a helper alias domain and as a mailbox on Mailcow (MC) like this: [email protected] (ME) -> [email protected] (MC alias) -> [email protected] (MC). And that works wonderfully so I do not need special routing on ME.
The problem is that Postfix sees mydomain.com as a local domain and tries to always deliver locally to it, ignoring the MX records. I need to configure Postfix as a SmartHost that delivers locally to accounts on MC and using MX records for accounts not present on MC. That's the way Office 365 works.
As every email that gets on ME is forwarded to MC I only care about moving old messages. For now, that is covered using imapsync, later I may finish/use a custom script to move ME's EML messages directly to dovecot Maildir while preserving UIDs.
Your solution with a transport field sounds very interesting, I would like to know more about it. And yes, I have not been able to make the Split Domain Routing work.
Thank you.
Hello,
Here is my temporary solution:
In addition to what was explained in my first post:
I am not very comfortable with how I am handling sender_access but for now this seems to be working. I will share a better solution if I find one. Thanks to everyone.
Most helpful comment
Just to clarify, Jane is using the original e-mail server and can not send to Bob on the Mailcow server?
If the above statement is correct then I don't think setting up transport maps on Mailcow will be able to solve your problem. The postfix manual says transport maps are only for determining the outgoing transport. You will need to set up transport maps on the original server (where Jane's account is located) in order to send to Bob on Mailcow1.
I'm working out a migration path to Mailcow right now as well. I am using transport_maps on mailcow to direct mail from users on mailcow to users on our old e-mail server. For users that are migrated to Mailcow I use Fetchmail to pull their e-mails from their inbox on the old server in to their Mailcow account. It isn't instant, but it is a bit simpler. You could also use GetMail for pulling e-mail from one server in to the local server.
While testing I added the field
transportto themailboxtable in order to hold transport information. Added this linetransport_maps = proxy:mysql:/opt/postfix/conf/sql/mysql_transport_maps.cfto main.cf, and this is mymysql_transport_maps.cffile:I haven't run in to any problems in the past day. If there is interest I can flesh out the implementation and submit a pull request.