I need to use SMTP relay from mailgun. It seems that I need to use smtp relay credentials for each domain I am hosting separately. For example: for domainA.com relayhost = [smtp.mailgun.org]:587 smtp_sasl_auth_enable = yes smtp_sasl_password_maps = static:[email protected]:password smtp_sasl_security_options = noanonymous for domainB.com relayhost = [smtp.mailgun.org]:587 smtp_sasl_auth_enable = yes smtp_sasl_password_maps = static:[email protected]:password smtp_sasl_security_options = noanonymous Any advice on how to achieve this in Postfix? Or is there any other SMTP relay provide who I can send emails through one relay account for multiple domains and they will relay it appropriately?
Attention, the following is untested As far as I understood, you want to set up the relay transports in ispconfig mail -> email routing. Then modify your postfix config main.cf: Code: smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd Use per domain credentials in /etc/postfix/sasl_passwd Code: @domain1.com userA:passwordA @domain2.com userB:passwordB Don't forget a "postmap hash:/etc/postfix/sasl_passwd" before postfix restart. Have never tried it, though ...
Hi, This is full solution for mailgun. To configure Postfix /etc/postfix/main.cf Code: smtp_sasl_auth_enable = yes smtp_sasl_security_options = noanonymous smtp_sender_dependent_authentication = yes smtp_sasl_password_maps = hash:/etc/postfix/smtp_sasl_passwd sender_dependent_relayhost_maps = hash:/etc/postfix/sender_relay The smtp_sasl_password_maps file contains a mapping of all domains to the appropriate SMTP credentials. The syntax must be as follows: /etc/postfix/smtp_sasl_passwd Code: @<domain> <smtp_user>@<domain>:<smtp_password> @<domain> <smtp_user>@<domain>:<smtp_password> Example: @test.com [email protected]assword (the username and password is provided by SMTP relay provider, in this case mailgun) The sender_dependent_relayhost_maps file contains a mapping of all domains to the appropriate relay. This option is not necessary if you are using a single relay. The syntax must be as follows: /etc/postfix/sender_relay Code: @<domain> <relay> @<domain> <relay> Example: @test.com [smtp.mailgun.org]:587 After you configure the above run: Code: postmap /etc/postfix/smtp_sasl_passwd postmap /etc/postfix/sender_relay systemctl restart postfix