php
  • phpmailer
  • hotmail
  • 2010-01-23 79 views 1 likes 
    1

    我試圖通過PHP腳本從我的服務器發送電子郵件。我曾經通過本地php函數郵件發送它,一切正常。下面是我使用的代碼:phpmailer與Hotmail?

    $to = $sMail;<br> 
    $subject = $sSubject;<br> 
    $message = $sMessage; 
    
    $headers = 'From: [email protected]' . "\r\n";<br> 
    $headers .= 'Reply-To: [email protected]' . "\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服務器報告錯誤:「由於策略原因,Windows Live Hotmail拒絕了550 SC-001郵件」。

    這是我用PHPMailer的代碼:

    $mail = new PHPMailer();<br> 
    $mail->IsHTML(true);<br> 
    $mail->CharSet = 'UTF-8';<br> 
    $mail->From  = '[email protected]';<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時必須有一個屬性來設置,但我似乎無法找到合適的屬性。任何人都知道這件事嗎?

    非常感謝!

    +1

    您是否試過僅向Hotmail帳戶發送一封電子郵件?如果發送多個電子郵件,則hotmail可能會懷疑其垃圾郵件並阻止它。 – 2010-01-23 20:58:23

    +0

    是的,我只是每次都嘗試發送一封電子郵件。 – nikola 2010-01-23 21:05:26

    +0

    maby你嘗試附加一個exe文件? – Dan 2010-01-23 23:53:11

    回答

    1

    嘗試刪除行$mail->FromName = 'domain.com';

    +0

    我試過了,但沒有改變。如果有幫助,下面是包含在錯誤響應中的消息正文: – nikola 2010-01-23 23:33:24

    +0

    返回路徑:<[email protected]> 收到:(由uid 33調用的qmail 28894); 23 Jan 2010 15:15:21 -0600 收件人:[email protected] 標題:標題 日期:2010年一月23日星期六15:15:21 -0600 From:Root User <[email protected]> Message-ID:<--- @ xxxxxx.xxx> X-Priority:3 X-Mailer:PHPMailer(phpmailer.sourceforge.net)[version 2.0.0 rc3] MIME版本:1.0 Content-Type:多部分/替代; boundary =「xxx」 --xxx Content-Type:text/plain; charset =「UTF-8」 Content-Transfer-Encoding:8bit Body --xxx – nikola 2010-01-23 23:35:04

    相關問題