我想从我的PHP应用程序发送邮件。以下是我的代码。邮件没有被发送与PHP
<?php
error_reporting (E_ALL);
ini_set ('SMTP', 'smtp.live.com');
ini_set ('smtp_port', '587');
ini_set ('sendmail_from', '[email protected]');
$to = "[email protected]";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$headers = "From:[email protected]\r\n";
$headers .= "X-Mailer: php\r\n";
$headers .= "Reply-To:[email protected]\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");
}
?>
它给我留言“邮件发送”,所以我希望收到邮件......但不要。假设收到邮件可能会有延迟,我现在等了3天。也检查了我的垃圾,但没有...所以我相信我的代码不是发送邮件....不知道为什么。
我可能错过了一些设置...但由于这是我第一次使用PHP邮件,我不知道什么设置丢失。在阅读Mail的文档...没有找到任何这样的要求/设置。任何帮助将非常感激。
不知道,你可以使用smtp.live.com从你的脚本,他们可能不会接受你的连接。 – Mario
你在设置你的hotmail用户名/密码吗?这个问题可能有助于[链接](http://stackoverflow.com/questions/9430412/how-to-set-smtp-username-and-password-using-ini-set) – Re0sless
希望这个问题可能现在被整理出来。是吗? – Jinandra