服务器发送邮件出现Could not connect to SMTP host错误 解决办法
2013-11-15 17:44
1031 查看
服务器发送邮件出现Could not connect to SMTP host错误 解决办法
功夫不负有心人,最后了解到,除了google的smtp服务器收到请求“smtp”会接受,其他服务器比如qq 163什么的必须要收到“smtp”请求(大写),郁闷呀!
解决办法:
在 class.phpmailer.php 中,将
function IsSMTP() {
$this->Mailer = 'smtp';
}
改成:
function IsSMTP() {
$this->Mailer = 'SMTP';
}
再次测试,终于看到了熟悉的面孔, QQ右下角提示 收到新邮件!问题解决!舒心呀!
后来我发现并不是因为修改了smtp为SMTP之后却能够发送邮件,这个并不是因为有些邮件服务器不能接受smtp的原因,而是并不是使用了smtp来发送邮件,PHPmailer里有一个判断的函数,
public function IsSMTP() {
$this->Mailer = 'SMTP';
}
switch($this->Mailer) {
case 'sendmail':
return $this->SendmailSend($header, $body);
case 'smtp'://由于SMTP和smtp不相等 所以选择的是下面MailSend发送邮件 并不是使用smtp发送邮件
return $this->SmtpSend($header, $body);
default:
return $this->MailSend($header, $body);
功夫不负有心人,最后了解到,除了google的smtp服务器收到请求“smtp”会接受,其他服务器比如qq 163什么的必须要收到“smtp”请求(大写),郁闷呀!
解决办法:
在 class.phpmailer.php 中,将
function IsSMTP() {
$this->Mailer = 'smtp';
}
改成:
function IsSMTP() {
$this->Mailer = 'SMTP';
}
再次测试,终于看到了熟悉的面孔, QQ右下角提示 收到新邮件!问题解决!舒心呀!
后来我发现并不是因为修改了smtp为SMTP之后却能够发送邮件,这个并不是因为有些邮件服务器不能接受smtp的原因,而是并不是使用了smtp来发送邮件,PHPmailer里有一个判断的函数,
public function IsSMTP() {
$this->Mailer = 'SMTP';
}
switch($this->Mailer) {
case 'sendmail':
return $this->SendmailSend($header, $body);
case 'smtp'://由于SMTP和smtp不相等 所以选择的是下面MailSend发送邮件 并不是使用smtp发送邮件
return $this->SmtpSend($header, $body);
default:
return $this->MailSend($header, $body);
相关文章推荐
- Godaddy服务器发送邮件出现Could not connect to SMTP host错误 解决办法
- 在服务器上用PHPMAIL发送邮件出现Could not connect to SMTP host错误 解决办法
- wordpress之SMTP发送邮件出现Could not connect to SMTP host解决办法
- 黄聪:VPS服务器如何配置PHP.ini解决wordpress使用WP-Mail-SMTP插件发邮件出现Could not connect to SMTP host的解决办法
- PHPMailer错误SMTP Error: Could not connect to SMTP host的解决办法
- PHPMailer发送邮件,出现无法连接host (Could not connect to SMTP host)
- 发送自动邮件时Could not connect to SMTP host: 10.1.1.195, port: 25;报错的解决方法
- phpmailer SMTP Error: Could not connect to SMTP host. 错误解决
- 关于使用Java Mail进行邮件发送,抛出Could not connect to SMTP host: xx@xxx.com, port: 25的异常可能
- 解决服务器连接错误Host ‘XXX’ is not allowed to connect to this MySQL server
- 解决服务器连接错误Host ‘XXX’ is not allowed to connect to this MySQL server
- PHPMailer不能连接SMTP服务器的两种常见原因(Could not connect to SMTP host)
- 解决服务器连接错误Host ‘XXX’ is not allowed to connect to this MySQL server
- 关于发送邮件出现no smtp MX only错误的解决办法
- scp 出现错误ssh: connect to host 9.123.159.41 port 22:connection refused的解决办法
- 解决问题:javax.mail.MessagingException: Could not connect to SMTP host: smtp.exmail.qq.com, port: 25;
- 远程连接服务器出现 SQL Error (1130): Host IP is not allowed to connect to this MySQL server 错误
- 解决服务器连接错误Host ‘XXX’ is not allowed to connect to this MySQL server
- 服务器连接错误Host 'XXX' is not allowed to connect to this MySQL server如何解决
- Docker出现Cannot connect to the Docker daemon. Is the docker daemon running on this host错误解决办法