Hi, I am trying to route emails by receipient domain name. For example, I need to route all hotmail.com emails to another server because hotmail is blocking my ip address. I have setup another postfix and I would like to route the emali to hotmail to the second postfix. The second server needs smtp authentication to relay. So far I can get the emails to go to the second server using ispconfig > email > email routing. How to make postfix authenticate to the second server so that the second server will accept it and relay it out? I have got the following setup for smtp authentication in /etc/postfix/main.cf smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_sasl_security_options = smtp_use_tls = yes What am I missing?
I have checked that and it seems it is for sender. For example for all emails from example.com will be routed to the relayhost. Can it be used for recipient hotmail.com, it will be routed to the relayhost?
Thank you for the advice. From the search got the following. https://serverfault.com/questions/7...-for-recipient-domains-matched-by-header-chec From there made the following. In ispconfig, ispconfig > email > content filter Filter: Header Filter Reqexp. Pattern: /^To: (.*?)@hotmail.com$/ Data: smtp:[some.example.com]:587 Action: FILTER Then in the /etc/postfix/main.cf setup the relay smtp server Code: smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_sasl_security_options = smtp_use_tls = yes In the file /etc/postfix/sasl_passwd Code: [some.example.com]:587 username:password Restart or reload postfix It works. Yahoooooooo!
My happiness was short lived. Here is the strange thing. When I did the test at night it works. Around lunch time, did the same test and it did not work. Now I test at night and it is working again. What am I missing? Could it be load on the server? I do not think so. Any suggestions where to check? If the send smtp server that was ment to send the email to hotmail was down, would postfix just send it by it self and not follow the transport?
Strange. Did you test from the same email address using same mail client? Is it possible that the domain partially still points to a different / old server in DNS (e.g. because a secondary DNS node did not pick up a DNS update)?
Just checked the dns on the master and the slave using dig and it is resolving correctly. Moreover, the errors can be seen in the current new server so it was doing it in the new server. Plus on the old server, postfix is off. Weird stuff. I am going to reboot the server and see how. Not now. Much later.
Used this for testing my regex. https://regex101.com/ It seems that if I use $ at the end of my regex, and the email address has some blank space after the email address, it will fail. Maybe that is what happened. Anyway I will know tomorrow if I start getting angry calls. This is what I am using now. Will report back later whether it works or not. Code: /^[tT]o: .*@hotmail\.com/