i am trying to send a mail from my PHP application. Below is my code.
<?php
error_reporting (E_ALL);
ini_set ('SMTP', 'smtp.live.com');
ini_set ('smtp_port', '587');
ini_set ('sendmail_from', 'mymail@hotmail.com');
$to = "urmail@hotmail.com";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$headers = "From:mymail@hotmail.com\r\n";
$headers .= "X-Mailer: php\r\n";
$headers .= "Reply-To:mymail@hotmail.com\r\n";
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$result = mail($to,$subject,$message,$headers);
if($result)
{
echo "Mail Sent.";
}
else
{
echo ("error");
}
?>
It gives me the message "Mail Sent" so i expect to receive the mail...but don't. Assuming there might be a delay in receiving the mail, i waited for 3 days now. Have also checked my Junk, but nothing...so i believe that my code is not sending a mail.... not sure why.
I may be missing out on some settings... but since this is my first time with PHP mails, i am not aware of what settings are missing. AFter reading up the documentations for Mail... didnt find any such requirements/settings. Any help would be really appreciated.