PHP mail()


#1
 <?php

$to = "somebody@example.com, somebodyelse@example.com";
$subject = “HTML email”;

$message = "

HTML email

This email contains HTML Tags!

Firstname Lastname
John Doe
";

$headers = “MIME-Version: 1.0” . “\r\n”;
$headers .= “Content-type:text/html;charset=iso-8859-1” . “\r\n”;
$headers .= ‘From: webmaster@example.com’ . “\r\n”;
$headers .= ‘Cc: myboss@example.com’ . “\r\n”;

mail($to,$subject,$message,$headers);
?>

i am trying to send mail from my website but whenever i run this script i will get below error pls help me out of this problem

Warning: mail() [function.mail]: Failed to connect to mailserver at “PHP_INI_ALL” port 25, verify your “SMTP” and “smtp_port” setting in php.ini or use ini_set() in C:\www\vhosts\localhost\task\alerts.php on line 105


#2

Are you testing this online or locally?

You can not test emails locally unless you set up your mail system to use SMTP.

Some servers must use SMTP also. So, let us know how you are testing your email code.