Return-Path header in php emails

I have a debian box with virtualmin-pro apache2 php4, I’ve been scratching my head on this for a while and can’t figure it out. When I use a php form to send email the server automatically sets the Return-Path header to www-data@localhost.localdomain. That is technically correct, username at domain, since it’s a script on the same server the domain is localhost.localdomain. But some servers will reject that wanting a real domain.

I googled it and tried the following:

  • Added the Return-Path header to the php script, that got ignored, it still used Return-Path: www-data@localhost.localdomain (Also it wouldn’t be my first choice of fix since I would have to get into every form and ‘email sending’ php script on the server)

  • Set a ‘ServerAdmin’ entry in /etc/apache2/apache2.conf - Again that did nothing.

  • I tried the same within the virtualserver in the host config file. - No go

  • Set ‘sendmail_from =’ in /etc/php4/apache2/php.ini - Nothing still

Where do I look next?


Raising an old thread from the dead, as I found this first and it didn’t have an answer.

I got the answer to this from another site:

I got it working. I just set the return path when calling the mail function.