今天在使用phpmailer发送邮件时居然提示SMTP Error: Could not authenticate,这个感觉是smtp设置的问题,下面我在网上找到了几种解决办法。
今天在使用phpmailer发送smtp邮件时提示 SMTP Error: Could not authenticate 错误,其中密码帐号都是正确的,邮箱也设置开启了SMTP功能。
上谷歌百度了一遍,有的说是服务器禁用了端口,有的说把class.phpmailer.php中的,代码如下:
- function IsSMTP() {
- $this->Mailer = 'smtp';
- }//改为
- function IsSMTP() {
- $this->Mailer = 'SMTP';
- }
测试以后还是不行,心中郁闷的一米,最后在一篇博客中找到了解决方法,先分享出来让更多遇到同样问题的人能得到帮助!
这个错误说明虚拟主机不支持PHPMailer默认调用的fsockopen函数,找到class.smtp.php文件,搜索fsockopen,就找到了这样一段代码:
- // connect to the smtp server
- $this->smtp_conn = @fsockopen($host,// the host of the server
- $port,// the port to use
- $errno, // error number if any
- $errstr, // error message if any
- $tval); // give up after ? secs
方法1:将fsockopen函数替换成pfsockopen函数,首先,在php.ini中去掉下面的两个分号
;extension=php_sockets.dll
;extension=php_openssl.dll
然后重启一下,因为pfsockopen的参数与fsockopen基本一致,所以只需要将@fsockopen替换成@pfsockopen就可以了。
方法2:使用stream_socket_client函数
一般fsockopen()被禁,pfsockopen也有可能被禁,所以这里介绍另一个函数stream_socket_client(),stream_socket_client的参数与fsockopen有所不同,所以代码要修改为如下:
$this->smtp_conn = stream_socket_client("tcp://".$host.":".$port, $errno, $errstr, $tval);
这样就可以了,如果上面办法还是没有解决可能是邮箱自动过滤你机器自动登录邮箱发邮件了哦,我是使用下面办法解决的,刚开始使用的qq的帐号,提示上面错误。换成新注册的163帐号可以正常发送。之后换了一个qq等级比较高的帐号,这下可以正常发送,没有报任何错误。因为收件人用的是qq邮箱帐号,所以发件帐号用qq的邮箱比较好,这样发送过多不会轻易的被拦截或判为垃圾邮件。所以结论就是配置中使用一个qq等级比较高的帐号(我的一个小号等级2个月亮可以正常使用,当然等级越高越好,)
结论:也要查看邮箱中“设置邮件地址黑名单”及“收信规则”,有时系统会自动将一些邮箱自动加入黑名单的
波比源码 » phpmailer发送邮件 SMTP Error: Could not authenticate 错误
levaquin 500mg pills order levaquin 250mg generic
dutasteride over the counter purchase avodart pills order zofran 8mg online
buy generic ampicillin 250mg cheap ampicillin 250mg purchase erythromycin generic
buy sildenafil 100mg for sale fildena 50mg tablet cost robaxin 500mg
order indomethacin 50mg generic buy suprax 200mg online cheap order generic amoxicillin 500mg
clonidine over the counter order generic meclizine 25mg tiotropium bromide 9 mcg for sale
terazosin pills brand actos order sulfasalazine 500 mg sale
cost fosamax 70mg buy panadol generic order famotidine 20mg
piracetam 800mg pills piracetam pill sildenafil 100mg pill
purchase linezolid online casino for real cash play online roulette for fun
buy omeprazole 20mg generic write essay service poker online for fun
cialis pills 40mg order cialis order sildenafil pills
purchase cialis without prescription cheap cialis 20mg purchase ciprofloxacin online
zocor 10mg without prescription buy valtrex online proscar 5mg pill
deltasone 20mg cost amoxil 500mg tablet oral amoxicillin 1000mg
viagra 100mg england sildenafil 50mg without prescription tadalafil 40mg ca
online casinos real money best ed pills non prescription order tadalafil 20mg online cheap
azithromycin medication zithromax 500mg for sale generic neurontin
legitimate online slots for money free poker online modafinil cheap
buy deltasone 10mg buy prazosin 1mg for sale buy vermox 100mg pills
order retin generic order tadalis for sale avana cheap
buy naprosyn 500mg sale buy generic lansoprazole 15mg order prevacid 30mg online cheap
tiotropium bromide 9 mcg tablet minocycline sale generic terazosin
buy singulair 5mg pills purchase sildenafil sale sildenafil order online
cialis sale buy ed medication online buy generic tadalafil 40mg
free spins no deposit us casino slots free best casino games
free roulette online online pharmacy meds academic writing online
asacol order online order astelin 10ml generic avapro 300mg for sale
order clobetasol for sale buy cordarone 200mg sale purchase amiodarone for sale
buy carvedilol pills purchase amitriptyline online order elavil 10mg without prescription
order amoxil pill stromectol canada ivermectin 3 mg
buy dapoxetine 30mg without prescription domperidone price domperidone over the counter
pepcid 20mg cost cheap pepcid mirtazapine 30mg sale
order doxycycline generic buy doxycycline 100mg pills medrol pill
tricor pills real viagra cheap sildenafil sale
order generic tadalafil 5mg sildenafil 100mg pill viagra 50mg price
minocycline online buy neurontin 800mg pill buy terazosin 5mg pills
tadalafil max dose tadalafil low price over the counter ed pills
order glucophage brand verapamil 240mg nolvadex 10mg pills
buy generic serophene prednisolone 5mg tablet buy generic prednisolone 20mg
purchase prednisone sale buy deltasone for sale amoxil uk
buy accutane 10mg online cheap accutane 40mg over the counter azithromycin 500mg oral
buy generic doxycycline 200mg cheap vibra-tabs acyclovir 800mg us
cost phenergan cialis mail order usa cialis 5mg for sale
zetia for sale online zetia 10mg pills methotrexate over the counter