phpmailer发送邮箱没法收到

phpmailer发送邮箱没法收到

在本地测试邮件发送,邮件接收都没有问题,但到阿里云服务器上就出问题了,邮件服务就报错了。通过仔细的排查,最后发现不是别的,而是阿里云邮件发送的25端口被禁用,致使不能使用smtp协议.
须要到阿里云去给这个25申请解禁,或者把端口换成465php

补充

网上大量的信息说,将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协议发送。这就突出了看源码的重要性了测试

相关文章
相关标签/搜索