服务器发送邮件出现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);

服务器发送邮件出现Could not connect to SMTP host错误 解决办法的更多相关文章

  1. 黄聪:VPS服务器如何配置PHP.ini解决wordpress使用WP-Mail-SMTP插件发邮件出现Could not connect to SMTP host的解决办法

    1.首先是WP-Mail-SMTP的下载地址:http://wordpress.org/plugins/wp-mail-smtp/ 2.出现Could not connect to SMTP host ...

  2. phpmailer SMTP Error: Could not connect to SMTP host. 错误解决

    今天发邮件遇到了这么一个问题:SMTP Error: Could not connect to SMTP host.在网上找了好多,都不管用.在这里我要提醒大家下 1.确保发送者邮箱密码正确,代码编写 ...

  3. Linux服务器ping不通域名出现的unknown host 错误解决办法

    "ping: unknown host www.baidu.com" 解决方法 如果某台Linux服务器ping不通域名, 如下提示: # ping www.baidu.compi ...

  4. SMTP Error: Could not connect to SMTP host

    PHPMailer是一个非常棒的开源邮件类,使用也非常简单,但是对于虚拟主机来说,往往要受到各种限制.刚才我在虚拟主机上使用PHPMailer就遇到一个“SMTP Error: Could not c ...

  5. 使用SpringBoot + JavaMailSender 发送邮件报错 Mail server connection failed;Could not connect to SMTP host

    说明: 出于安全考虑,阿里云默认封禁 TCP 25 端口出方向的访问流量,无法在阿里云上的云服务器通过 TCP 25 端口连接外部地址. [官方提示]:如果您需要使用阿里云上的云服务器对外部发送邮件, ...

  6. Could not connect to SMTP host: smtp.***.com, port: 465, response: -1

    背景 在使用javamail进行邮件发送的时候,报错: Could not connect to SMTP host: smtp.***.com, port: 465, response: -1 原因 ...

  7. 解决 SMTP Error: Could not connect to SMTP host. 问题

    我在使用PHPmailer发邮件时候,遇到了这个问题“SMTP Error: Could not connect to SMTP host.”,分享一下解决方法. 这个错误是PHP版本7产生的.如果我 ...

  8. javax.mail.MessagingException: Could not connect to SMTP host: smtp.xdf.cn

    1.问题描述:关于使用Java Mail进行邮件发送,抛出Could not connect to SMTP host: xx@xxx.com, port: 25的异常可能: 当我们使用Java Ma ...

  9. 【Linux】【Jenkins】邮件发送失败的问题javax.mail.MessagingException: Could not connect to SMTP host:

    javax.mail.MessagingException: Could not connect to SMTP host: smtp.126.com,port:25 解决方案: 之前用的是126邮箱 ...

随机推荐

  1. react style: 二级菜单

    1.样式 @import "../../styles/varibles"; .app-sidebar { overflow: hidden; width: 180px; > ...

  2. B. Clique Problem(贪心)

    题目链接: B. Clique Problem time limit per test 2 seconds memory limit per test 256 megabytes input stan ...

  3. 年终盘点:Java今年的大事记都在这里!

    在2017年即将结束之际,我们最好停下脚步来看看过去十二个月Java的发展情况.本文,笔者盘点了IT168企业级一年来对Java的跟踪报道. 这一年对Java来说是不容易的,从Java 9一再延期备受 ...

  4. Ubuntu 中 java 环境 (sunjdk) 的配置 (附详细说明)

    暑假以来为了鼓捣双系统废了很大的劲儿,本来一股脑想装 CentOS,无奈怎么处理分区引导都不能成功地与 Win8 共存,最终用 Ubuntu 一句 "检测到系统上有 Windows Boot ...

  5. HDU - 6183:Color it (线段树&动态开点||CDQ分治)

    Do you like painting? Little D doesn't like painting, especially messy color paintings. Now Little B ...

  6. 剑指Offer-第一章面试细节总结

    面试细节:行为面试(20%)+技术面试(70%)+应聘者提问(10%) * 行为面试:跳槽者(不要抱怨老板,不要抱怨同事,只为追寻自己的理想而站斗) * 技术面试:1.基础知识点(编程语言,数据结构( ...

  7. Java Config 注解

    java config是指基于java配置的spring.传统的Spring一般都是基本xml配置的,后来spring3.0新增了许多java config的注解,特别是spring boot,基本都 ...

  8. js中使用分号的情况

  9. 错过的sql语句

    总结: 内链接:适合和自己的条件对比,但并没有给出具体条件,要从数据库表里面找,注意有些条件两个表都需要写(嵌套查询貌似也可以 左连接:适合一个表要全部列出来的情况(使用count的时候,注意coun ...

  10. Spring security 浅谈用户验证机制

    step1:首先ApplicationUserDetailsService需要实现UserDetailsService接口(在 org.springframework.security.core.us ...