I'm configuring a new web server and i need to make emails from my PHP scripts to be sent. Most messages should be sent using mandrill SMTP and some "directly" from my server to email services. I registered an account at mandrill and configured postfix server according to this tutorial. I created /etc/postfix/sasl_passwd and edited main.cf file. I set relayhost to mandrill SMTP.
relayhost = [smtp.mandrillapp.com]
If i try sending messages when postfix configured this way - all messages being sent using mandrill SMTP. I tried it and it works. But as i said, i need some messages to be sent directly. I determine, which emails should be sent using SMTP and which directly, by setting different sender("from") email addresses.
In the tutorial i mentioned i found that to do what i need, i need to use sender_dependent_relayhost_maps option and remove the value of relayhost.
I use the following config
relayhost =
sender_dependent_relayhost_maps = hash:/etc/postfix/relayhost_maps
I created /etc/postfix/relayhost_maps and it looks like this
[email protected] [smtp.mandrillapp.com]
Now all messages should be sent directly, except for messages from [email protected] that must be sent using external SMTP. The problem is when i try to send messages with this configuration - all messages being sent directly(i see this in gmail when i receive it).
I tried putting in /etc/postfix/relayhost_maps different SMTP hosts, different email addresses but all messages still being sent directly.
Please, help me solve this problem.
0 Answers