2017-06-07 91 views
0

我正在使用G Suite SMTP中繼服務完成訂單時向客戶發送多封電子郵件的電子商務網站。但是大量這些電子郵件都失敗了。似乎也沒有任何模式 - 有時候所有的電子郵件都會發送,有時候只有一兩次,有時甚至沒有。調試SMTP電子郵件故障 - GSuite

我收到以下錯誤:421, "4.7.0", Try again later, closing connection

尋找這裏:https://support.google.com/a/answer/3726730?hl=en並沒有真正幫助我調試,或找出爲什麼一些電子郵件失敗。

我使用的PHPMailer類(https://sourceforge.net/projects/phpmailer/

這個問題似乎在第一握手失敗發生:

function Hello($host="") { 
    $this->error = null; # so no confusion is caused 

    if(!$this->connected()) { 
     $this->error = array(
      "error" => "Called Hello() without being connected"); 
     return false; 
    } 

    # if a hostname for the HELO was not specified determine 
    # a suitable one to send 
    if(empty($host)) { 
     # we need to determine some sort of appopiate default 
     # to send to the server 
     $host = "localhost"; 
    } 

    // Send extended hello first (RFC 2821) 
    //If this fails then the second attempt will always fail 
    if(!$this->SendHello("EHLO", $host)) 
    { 
     //when this fails it generates the try again later error 
     if(!$this->SendHello("HELO", $host)) 
      return false; 
    } 

    return true; 
    } 

那麼,什麼是調試這個最好的方法?

+0

添加調試記錄器和步驟記錄以確定確切的問題。 –

回答

0

錯誤消息非常明確。您可以調用第三方網絡服務,該服務會返回一個錯誤代碼,說明您所調用的服務器已滿負荷運行,請稍後再試。這是一項免費服務,允許您升級到付費計劃嗎?通常你會看到他的那種東西。

+0

是的,它是我們使用的Google G Suite SMTP中繼服務,已付費。我們每天最多可以發送10k封電子郵件,而且我們沒有接近此地址的地方,我發現很難想象Google的某個服務器正在滿負荷運轉。 –

+0

是的,我不能圖片,要麼 – delboy1978uk