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.
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:
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 has NOT specified the “from” value in “additional parameters”: