Mail headers with php mail()


#1

I’m setting up a feature for my users which will allow them to receive an email link to reset their password if they forget it. The php mail() feature works just fine, except that when looking at the email headers, my dreamhost username is listed in the Return-Path and Received-SPF fields. Call me paranoid, but I don’t want that happening. Is there a setting dreamhost has that can avoid this?


#2

Does “Example 2. Sending mail with extra headers.” at http://us3.php.net/function.mail work?

tor.eff.org


#3

I’ve tried that and the resulting email simply has two instances of each header field.

I’m wondering if I just have to accept this.


#4

I recall encountering exactly this problem in the past, from memory it was resolved by using the optional ‘additional_parameters’ parameter of mail() to pass the sender address to sendmail.

Something like…

mail( $to, $subject, $message, null, ‘-fsender@example.com’ );

Mark


Save [color=#CC0000]$50[/color] on DreamHost hosting using promo code [color=#CC0000]SAVEMONEY[/color] ( Click for promo code details )


#5

Yes, that’s it! I don’t know what I did wrong when I tried this previously.

Thanks to both Tor and Mark :slight_smile: