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
Comments
Submitted by Axis100 on Sun, 04/10/2016 - 14:25 Comment #1
Submitted by andreychek on Sun, 04/10/2016 - 14:44 Comment #2
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.
Submitted by Axis100 on Sun, 04/10/2016 - 14:46 Comment #3
andreychek, thank you kindly - forgot to include link to article?
Submitted by andreychek on Sun, 04/10/2016 - 14:52 Comment #4
Oops, so I did! Here is the article:
http://slopjong.de/2013/02/05/setting-return-path-in-php-mail/
Submitted by Axis100 on Sun, 04/10/2016 - 14:59 Comment #5
Solved, the -f parameter worked and fixed the SPF issues. Thank you so much andrey!
Submitted by Axis100 on Sun, 04/10/2016 - 15:00 Comment #6