【问题标题】:phpmailer with hotmail?带hotmail的phpmailer?
【发布时间】:2011-01-08 15:23:19
【问题描述】:

我正在尝试通过 PHP 脚本从我的服务器发送电子邮件。我曾经通过本机 php 函数 mail 发送它,一切正常。这是我使用的代码:

$to  = $sMail;<br>
$subject = $sSubject;<br>
$message = $sMessage;

$headers  = 'From: user@domain.com' . "\r\n";<br>
$headers .= 'Reply-To: user@domain.com' . "\r\n";<br>
$headers .= 'MIME-Version: 1.0' . "\r\n";<br>
$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";<br>


$bRes = mail($to, $subject, $message, $headers);

然后我切换到 PHPMailer,但无法将邮件发送到 Hotmail 帐户(所有其他仍然有效)。 Hotmail 服务器报告错误:“550 SC-001 邮件因策略原因被 Windows Live Hotmail 拒绝。”

这是我用于 PHPMailer 的代码:

$mail = new PHPMailer();<br>
$mail->IsHTML(true);<br>
$mail->CharSet = 'UTF-8';<br>
$mail->From     = 'user@domain.com';<br>
$mail->FromName = 'domain.com';<br>
$mail->Subject  = $sSubject;;<br>
$mail->Body     = $sMessage;<br>
$mail->AltBody  = strip_tags($sMessage;);<br>
$mail->AddAddress($sMail);<br>
$mail->Send();<br>
$mail->ClearAddresses();<br>
$mail->ClearAttachments();

由于发送与本机功能一起使用,我确信我的服务器能够将邮件发送到 hotmail。使用 PHPMailer 时必须设置一个属性,但我似乎找不到合适的。有人知道这个吗?

非常感谢!

【问题讨论】:

  • 您是否尝试过仅向 hotmail 帐户发送一封电子邮件?如果它的多封电子邮件被发送,hotmail 可能会怀疑它的垃圾邮件并阻止它
  • 是的,我每次只尝试发送一封电子邮件。
  • 你是否尝试附加一个 exe 文件?
  • 不,根本没有附件。这是一封我目前仅用于测试的电子邮件,它只包含一个句子。我猜标题里有东西??
  • 添加回复地址,这将解决它

标签: php phpmailer hotmail


【解决方案1】:

尝试删除行$mail-&gt;FromName = 'domain.com';

【讨论】:

  • 我试过了,但没有改变。如果有帮助,以下是错误响应中包含的消息正文:
  • 返回路径: 收到:(由uid 33调用的qmail 28894); 2010 年 1 月 23 日 15:15:21 -0600 收件人:xxx@hotmail.com 主题:主题日期:​​星期六,2010 年 1 月 23 日 15:15:21 -0600 发件人:根用户 邮件 ID: X-Priority: 3 X-Mailer: PHPMailer (phpmailer.sourceforge.net) [version 2.0.0 rc3] MIME-Version: 1.0 Content-Type: multipart/alternative;边界="xxx" --xxx 内容类型:文本/纯文本; charset = "UTF-8" Content-Transfer-Encoding: 8bit Body --xxx
猜你喜欢
  • 2013-03-20
  • 1970-01-01
  • 2014-12-10
  • 1970-01-01
  • 2014-02-04
  • 2015-10-24
  • 1970-01-01
  • 2015-11-07
  • 1970-01-01
相关资源
最近更新 更多