php send mail code not working

Posted by anand on Stack Overflow See other posts from Stack Overflow or by anand
Published on 2009-07-09T15:16:56Z Indexed on 2012/10/05 9:37 UTC
Read the original article Hit count: 323

Filed under:
|
|

php
$to = "[email protected]";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
if (mail($to, $subject, $body)) {
  echo("pMessage successfully sent!/p");
 } else {
  echo("pMessage delivery failed.../p");
 }

wrote a basic php sendmail code that but it gives me the following error


Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in C:\xampp\htdocs\mail.php on line 5
Message delivery failed...

i changed the php.ini file and put [email protected] but still the problem persists... writing the mail script for the first time

Am i doing something wrong? is there a better code or way to go thru this?

Any help will be appreciated

Thank you

© Stack Overflow or respective owner

Related posts about php

Related posts about sendmail