使用php发送有附件的电子邮件-(PHPMailer使用的实例分析)

前端技术 2023/09/02 PHP

http://xiazai.phpstudy.net/201304/yuanma/PHPMailer_phpstudynet.rar
另外,将当时出现的问题所收录的内容整理如下:

1、Error: Could not connect to SMTP host
原因1:不邮邮件系统要求的smtp请求不同一,但是都允许大写,有些不支持小写,比如网易,腾讯的邮箱。(至于是不是这样,我没测试过,反正都改为大写,也不影响)

解决方法:

复制代码 代码如下:

public function IsSMTP() {
  $this->Mailer =\'SMTP\'; // 将smtp ->SMTP ;即原来是小写,现在大写。
}

// Choose the mailer and send through it
switch($this->Mailer) {
  case \'sendmail\':
    return $this->SendmailSend($header, $body);
  case \'SMTP\'://同样 将smtp ->SMTP ;即原来是小写,现在大写。
    return $this->SmtpSend($header, $body);
  case \'mail\':
  default:
    return $this->MailSend($header, $body);
}

本文地址:https://www.stayed.cn/item/3690

转载请注明出处。

本站部分内容来源于网络,如侵犯到您的权益,请 联系我

我的博客

人生若只如初见,何事秋风悲画扇。