note 86360 added to book.mail

From: Date: Tue, 14 Oct 2008 20:42:39 +0000
Subject: note 86360 added to book.mail
Groups: php.notes 
Request: Send a blank email to php-notes+get-145363@lists.php.net to get a copy of this message
What "Some Guy" stated is true (for my case at least). I am running WinXP Pro, IIS5, PHP5. To test PHP's mail function, I utilized the below code that "dev at realynospamspcweb dot nl" posted (the code that they stated worked for them without errors). <?php $Name = "Da Duder"; //senders name $email = "email@adress.com"; //senders e-mail adress $recipient = "PersonWhoGetsIt@emailadress.com"; //recipient $mail_body = "The text for the mail..."; //mail body $subject = "Subject for reviever"; //subject $header = "From: ". $Name . " <" . $email . ">\r\n"; //optional headerfields mail($recipient, $subject, $mail_body, $header); //mail command :) ?> This (the above code) did not work for me. But after utilizing "Some Guy's" tip and making the below modification, it did. Thank you "Some Guy". <?php $Name = "Da Duder"; //senders name $email = "email@adress.com"; //senders e-mail adress $recipient = "PersonWhoGetsIt@emailadress.com"; //recipient $mail_body = "The text for the mail..."; //mail body $subject = "Subject for reviever"; //subject $header = "From: ". $Name . " <" . $email . ">\r\n"; //optional headerfields ini_set('sendmail_from', 'me@domain.com'); //Suggested by "Some Guy" mail($recipient, $subject, $mail_body, $header); //mail command :) ?> Now this code worked for me. It might be of interest that I did not need to modify any of the default "php.ini" settings... SMTP = localhost smtp_port = 25 ---- Server IP: 69.147.83.197 Probable Submitter: 76.247.51.5 ---- Manual Page -- http://www.php.net/manual/en/book.mail.php Edit -- https://master.php.net/note/edit/86360 Del: integrated -- https://master.php.net/note/delete/86360/integrated Del: useless -- https://master.php.net/note/delete/86360/useless Del: bad code -- https://master.php.net/note/delete/86360/bad+code Del: spam -- https://master.php.net/note/delete/86360/spam Del: non-english -- https://master.php.net/note/delete/86360/non-english Del: in docs -- https://master.php.net/note/delete/86360/in+docs Del: other reasons-- https://master.php.net/note/delete/86360 Reject -- https://master.php.net/note/reject/86360 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#145363) next »