我一直在谷歌搜索并尝试不同的解决方案几个小时。 它适用于GMail和Yahoo,但是使用Hotmail,它会进入垃圾文件夹。
这是我的代码:
$sender = "xxx";
$sendername = "xxx";
$recipient = "xxx";
$recipientname = "xxx;
$pm->SetFrom($sender, $sendername);
$pm->AddReplyTo($sender, $sendername);
$pm->Sender = "xxx";
$pm->AddAddress($recipient, $recipientname);
$pm->IsSMTP();
$pm->SMTPAuth = true;
$pm->SMTPDebug = 2;
$pm->Host = "mail.xxx.com";
$pm->Port = 587;
$pm->Username = "xxx";
$pm->Password = "xxx";
$pm->Subject = "xxx news";
$pm->AddEmbeddedImage('forumLogo.png', 'logo');
$pm->Body = 'Here is my HTML content, not spammy.
</body>
</html>';
$pm->isHTML(true);
var_dump($pm->ErrorInfo);
if(!$pm->Send()) {
echo "Couldn't send: " . $pm->ErrorInfo;
}
else {
echo "Sent";
}