我想從我的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