php mail sender address

Having an issue with Postfix / PHP.

My Virtualmin hosts 37 domains on one IP.

IP and rDNS resolves to mymaindomain.com

When using php mail() function, headers get sent correctly as ---- From: user@domain37.com

However Return-Path shows as www-data@mymaindomain.com and also this:

Received-SPF: neutral (google.com: xxx.xxx.xxx.xxx is neither permitted nor denied by best guess record for domain of www-data@mymaindomain.com)

How do I solve this in postfix, bind config and / or php config?

Also, some of the 37 domains use external MX (Google, GoDaddy). I'd like to be able to have the server send email via php with correct return path / spf as user@domain37.com AND also send/receive email under the same email address when using webmail provided by the mx handler (Google, Godaddy etc)

Thank you

Status: 
Closed (fixed)

Comments

Howdy -- by default, Postfix will set the return path to the user sending the email (which is Apache in this case), followed by the hostname of your server.

It may be possible to change that in some circumstances.

Take a peek at this article here, which describes a parameter they believe will change the return path. They show how to do it within PHP.

I unfortunately haven't tested it before, but if that parameter is indeed valid then I believe it should do what you're after.

andreychek, thank you kindly - forgot to include link to article?

Solved, the -f parameter worked and fixed the SPF issues. Thank you so much andrey!

Status: Active ยป Closed (fixed)