Forum Moderators: coopster

Message Too Old, No Replies

php mail() change header Return-path

Is this the script or the server?

         

Patrick Taylor

8:11 am on Mar 27, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm using php mail() to send emails back from a contact form, but the emails are being stopped by the mail server's anti-spam settings, it seems, most likely because its own domain is included in the email header's Return-path:

From - Mon Mar 27 00:59:54 2006
X-Account-Key: account2
X-UIDL: UID2902-1234266529
X-Mozilla-Status: 0001
X-Mozilla-Status2: 00000000
Return-path: <admin @ domain.com>
etc

I know I can add additional headers, but I'm looking at the main header in the email source. Is this a server setting that the hosting provider needs to change, or can the php mail script be made to change this to something like:
Return-path: <nobody @ servername.com>?

barns101

8:53 am on Mar 27, 2006 (gmt 0)

10+ Year Member



You can set your own return-path:


mail($to,$subject,$message,$headers,"-fadmin@domain.com");

Or


mail($to,$subject,$message,"Return-path: admin@domain.com");

Some server setups require the first code in order to specify the return-path whereas others will work with the latter.

Patrick Taylor

9:10 am on Mar 27, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks ever so much. The first one seems to have done the trick, but with a space after the "-f ".