Php Mail
Posted: Mon Jun 20, 2005 5:41 am
All,
If someone can help in this , it will be great.
I am trying to send mail from php using the below code.
<?php
$to = "sriram_s_98@yahoo.com";
$from = "sriram_s_98@yahoo.com";
$subject = "This is a test email";
$message = "Dear John,\n\nThis is a fake email, I hope you enjoy it.\n\nFrom Jane.";
$headers = "From: $from\r\n";
$success = mail($to, $subject, $message, $headers);
if ($success)
echo "The email to $to from $from was successfully sent";
else
echo "An error occurred when sending the email to $to from $from";
?>
I get the following error message.
Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\program files\Apache Group\Apache2\htdocs\phpmail.php on line 9
An error occurred when sending the email to sriram_s_98@yahoo.com from sriram_s_98@yahoo.com
I am using windows XP client OS running on Apache webserver.
Can someone let me know where I am going wrong.
Regards
If someone can help in this , it will be great.
I am trying to send mail from php using the below code.
<?php
$to = "sriram_s_98@yahoo.com";
$from = "sriram_s_98@yahoo.com";
$subject = "This is a test email";
$message = "Dear John,\n\nThis is a fake email, I hope you enjoy it.\n\nFrom Jane.";
$headers = "From: $from\r\n";
$success = mail($to, $subject, $message, $headers);
if ($success)
echo "The email to $to from $from was successfully sent";
else
echo "An error occurred when sending the email to $to from $from";
?>
I get the following error message.
Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\program files\Apache Group\Apache2\htdocs\phpmail.php on line 9
An error occurred when sending the email to sriram_s_98@yahoo.com from sriram_s_98@yahoo.com
I am using windows XP client OS running on Apache webserver.
Can someone let me know where I am going wrong.
Regards