phpmailer發送郵箱無法收到

phpmailer發送郵箱無法收到

在本地測試郵件發送,郵件接收都沒有問題,但到阿里雲服務器上就出問題了,郵件服務就報錯了。經過仔細的排查,最後發現不是別的,而是阿里雲郵件發送的25端口被禁用,導致不能使用smtp協議.
需要到阿里雲去給這個25申請解禁,或者把端口換成465

補充

網上大量的信息說,將phpmailer中IsSMTP的smtp 改成SMTP,其實是有誤導性的

/**
   * Sets Mailer to send message using SMTP.
   * @return void
   */
  public function IsSMTP() {
    $this->Mailer = 'SMTP';
  }
// Choose the mailer and send through it
      switch($this->Mailer) {
        case 'sendmail':
          return $this->SendmailSend($this->MIMEHeader, $this->MIMEBody);
        case 'smtp':
          return $this->SmtpSend($this->MIMEHeader, $this->MIMEBody);
        default:
          return $this->MailSend($this->MIMEHeader, $this->MIMEBody);
      }

上面改了以後,會走到php默認的mail方法,而不會使用smtp協議發送。這就突出了看源碼的重要性了


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章