[thelist] PHP mail headers

// kerin | airside.co.uk kerin at airside.co.uk
Wed Sep 26 09:17:57 CDT 2001


Hi everyone,

I'm using PHP to send out mail using the mail() function.

Here's a snippet of my code:

while($row = mysql_fetch_array($sql_result)) {
     $email = $row["email"];
     $firstname = $row["firstname"];
     $secondname = $row["secondname"];

     $headers ="From: mailinglist at pauloakenfold.com\r\nReply-To: 
mailinglist at pauloakenfold.com\r\nTo: '".$firstname." ".$secondname."' 
<".$email.">";

     mail($email,$subject,$body,$headers);
}

now, the mail sounds out fine, except that the mail headers don't 
work. The most important of these is the From: field. At the minute, 
the From field in the received email is our ISPs equivalent of 
root at localhost - not desirable.

I've tried every permutation on the From field I can think of -

from: mailinglist at pauloakenfold.com <pauloakenfold.com>
from: pauloakenfold.com <mailinglist at pauloakenfold.com>
from: mailinglist at pauloakenfold.com
from: <mailinglist at pauloakenfold.com>

And I still get root at localhost in the From: field.

Oh, and all of my so-called "header" fields just get dumped in the 
message body.

Where am I going wrong?
-- 




More information about the thelist mailing list