几个小时以来,我一直在谷歌搜索并尝试不同的解决方案。它适用于 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";
}