Error in sending a email..

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
varma457
Forum Newbie
Posts: 23
Joined: Sat Jul 11, 2009 2:43 pm

Error in sending a email..

Post by varma457 »

Hi,

I have problem with sending EMAIL..

I am simple script to send a email..


$to = "abc@yahoo.com";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
if (mail($to, $subject, $body)) {
echo("<p>Message successfully sent!</p>");
} else {
echo("<p>Message delivery failed...</p>");
}

But it is showing the error..
Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in C:\chitti1\xampp\htdocs\Test\mail.php on line 9
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Error in sending a email..

Post by Christopher »

The error message says 'custom "From:" header missing'. Check the manual for the mail() function. It has an example of how to set the From: header.
(#10850)
Post Reply