All Linux HowTo's

Postfix & Sending From Multiple Domains & PHP

This article should be of benefit to anyone who has a php application sending emails from multiple domain names, a postfix mail server and the need to have emails properly routed depending on the sending domain name.

We’re dealing with a situation where the mail server is “sending” from multiple domains but not “receiving”. In other words, no local delivery.

If you’re sure Postfix is configure properly with the following instructions, it is likely how the email is being constructed and how Postfix is using the header information to determine the “from” domain.

https://community.rackspace.com/products/f/28/t/3897

The key point is at the end of the above article. It explains that Postfix will use the “additional parameters” to find the specific domain name to send from.

See php documentation here:

http://php.net/manual/en/function.mail.php

If you don’t set the “from” address in “additional parameters”, Postfix will apply the default domain name found in the Postfix “main.cf” file in the “mydomain” variable.

The following are extracts from the header having received the email. In this example, the Postfix “main.cf” file has the “mydomain” set to “default.com”.

Sender specified the “from” value in “additional parameters”:

Sender: no-reply=example2,com@example2.com

Sender has NOT specified the “from” value in “additional parameters”:

Sender: no-reply=example2,com@default.com

Similar Posts: