PHPMailer 香港主机SMTPsvn无法连接主机 拒绝被拒绝

分享主题:linux,nginx,php,mysql
> php使用phpmailer发邮件,在window可以使用,linux无法发送邮件,出现could not connect to smtp host错误
特惠:每月100元,就能观看子恒老师所有视频,下载源码
猛击这里加客服QQ:了解
免费下载,让你的网站3秒变在线商城,马上实现,扫码支付和微信h5支付功能。
phpmailer是一个发送邮件的php类库,
前段时间出现一个很诡异的现象,
在window能够正常发送邮件,
上传到linux就无法使用。
出现could not connect to smtp host错误
邮箱的账号密码都没有变,
后面使用下面的方法解决。
phpmailer发送邮件,
默认使用 25 端口,
上传到linux后,
把端口改成 465 就行。
部分核心代码
$mail = new PHPMailer(false);
$mail-&SMTPSecure = 'ssl';
$mail-&Port
$mail->SMTPSecure = ‘ssl’;
需要新增,
原来使用 25 端口时没有。
这种发送邮箱的方式是加密过的,
会更安全。
加子恒老师公众号 性感笔记
回复 email
免费下载 phpmailer 类库
观看《》视频
免费下载,让你的wordpress网站3秒变在线商城,马上实现,扫码支付和微信h5支付功能。
来源:,欢迎转载分享,请保留出处
php使用phpmailer发邮件,在window可以使用,linux无法发送邮件,出现could not connect to smtp host错误链接:
现在就加入微信开发QQ群2:,跟同行探讨微信公众平台开发。群满就关闭,你得等到下一个群开通才能加入……
微信公众平台开发推荐文章
微信营销热门文章……The other day I was experiencing some problems with my GoDaddy hosted site. I called their tech support, and the person that I spoke with suggested that my problems were related to the fact that I was on a Windows box and would be better served on a Linux box. Having no opinion on this, I agreed and they switched me over.
In the wake of that transition, my PHPMailer functionality has deserted me. I have had this working for months, so I know that my settings are accurate. I have confirmed with GoDaddy that the account I am trying to send out of has not changed from their perspective. No changes have been made on the user side (like a new password). Bottom line, the only thing that is different is that my site is now hosted on a Linux server. That's it.
So I assume that my PHPMailer difficulties must be related to that, since it is too much of a coincidence that a script that has worked for months fails at the exact moment that the server transition occurs. But why? I spent an hour with their tech support, and they see nothing wrong with the server settings. We verified my settings (just for fun). Everything looks good, but when I send an email, I get this error:
SMTP -& ERROR: Failed to connect to server: Connection refused (111)SMTP Connect() failed.
There are many posts about this type of error, and almost all of them relate to people getting set up for the first time who have mis-entered settings or omitted settings. However, I KNOW that my settings are complete and accurate since I've been using them successfully for months. I'll post them here just for completeness:
$mail = new PHPMailer();
$mail-&IsSMTP();
//telling the class to use SMTP
$mail-&isHTML(true);
$mail-&Host
= "smtpout.secureserver.net"; //also tried "relay-hosting.secureserver.net"
$mail-&WordWrap
$mail-&SMTPAuth
$mail-&SMTPSecure
$mail-&Port
$mail-&Username
$mail-&Password
= *******;
$mail-&Subject
= "Test Email";
$mail-&SMTPDebug = 1;
Does anyone have any ideas why this might be happening? Is there some server setting that the tech support people might not be aware of, like maybe in my php.ini file? The guy I worked with did his best to help me out, but he may just not be aware of something.
Any help is appreciated. Let me know if there is any other information I can provide. Thanks!
EDIT: I should also mention some of the other attempts that I made.
I get the same result no matter what.
1) TLS with port 587
2) Without SSL using ports 25, 80, and 3535.
2) My own gmail address modifying the server, username, password, etc.
解决方案 As it seems this is a continuing problem, let me add my own experience.
Our website uses PHPMailer and the site is hosted on a GoDaddy linux server. The settings that seemed to be correct (according to everything I could find on SO and the goDaddy support site) were as follows:
SMTP_SERVER: smtpout.secureserver.net (or alternatively relay-hosting.secureserver.net)
SMTP_PORT: 465 //or 3535 or 80 or 25
SMTP_AUTH: true //always
SMTP_Secure: 'ssl' //only if using port 465
After spending 6+ hours trying every variation of ports(25, ), servers
relay-hosting.secureserver.net,smtpout.secureserver.net:[port], etc.), usernames, passwords,etc. I called goDaddy.
Another 40 minutes later, it was revealed that:
1) the "workspace" email accounts are being retired. That's important because if you have an email account with goDaddy today, you likely have a Workspace account. This is, according to the tech support rep, hosted separately from you linux account.
2) goDaddy is moving toward cPanel email accounts.
Time table?
"...in the next 2 to 3 years!"
3) I moved our accounts from Workspace to cPanel accounts while I was on the phone with the rep.
Really easy to do.
4) After you change your email accounts (including editing your MX records) to a cPanel email (vs. a "workspace" email) the appropriate settings for a web-form email using PHPMailer are:
SMTP_SERVER: localhost
//(and I mean literally: "localhost"- in place of smtp.secureserver.net and relay-hosting.secureserver.net, etc.)
... and everything else (as above) the same...
The webform I built with PHPMailer worked perfectly after this change!
Use your cPaneL email account login (username) and password in the PHPMailer setup and your web emails will work seamlessly!
An added bonus is that webmail (does anybody use this anymore?) can be accessed at [yourdoman]\webmail.
No more cryptic url's to remember!
And the accounts cand be IMAP or POP!
Admittedly, this means you must use goDaddy's cPanel email accounts, but getting the webform to work flawslessly with PHPMailer was the real reward!
本文地址: &
有一天我遇到了我的GoDaddy托管网站的一些问题。我打电话给他们的技术支持,而我说话的人建议我的问题与我在一个Windows盒子上的事实有关,在Linux盒子上会更好。对此没有任何意见,我同意了,他们切换了我。
在转换之后,我的PHPMailer功能让我失望了。我已经工作了好几个月,所以我知道我的设置是准确的。我已经与GoDaddy确认,我想发送的帐户没有从他们的角度改变。在用户端没有进行任何更改(如新密码)。底线,唯一不同的是我的网站现在托管在Linux服务器上。那就是这样。
所以我假设我的PHPMailer的困难必须与之相关,因为在几个月内工作的脚本失败了太多的巧合服务器转换发生的确切时刻。但为什么?我花了一个小时与他们的技术支持,他们看到没有任何错误的服务器设置。我们验证了我的设置(只是为了好玩)。一切看起来不错,但是当我发送电子邮件时,我收到这个错误:
- &错误:无法连接到服务器:拒绝连接(111)SMTP Connect()失败。
有很多关于此类错误的帖子,几乎所有这些都与首次设置错误输入设置或省略设置的人有关。但是,我知道我的设置是完整和准确的,因为我成功使用它几个月。我将在这里发布他们的完整性:
$ mail = new PHPMailer();
$ mail-& IsSMTP(); //告诉类使用SMTP
$ mail-& isHTML(true);
$ mail-& Host =“smtpout.secureserver.net”; //也尝试过“relay-hosting.secureserver.net” $ mail-& WordWrap = 50;
$ mail-& SMTPAuth =
$ mail-& SMTPSecure =“ssl”;
$ mail-& Port = 465;
$ mail-& Username =“”;
$ mail-& Password = *******;
$ mail-& Subject =“测试电子邮件”;
$ mail-& SMTPDebug = 1;有没有人有什么想法为什么会发生这样的事情?
有没有一些服务器设置技术支持人们可能不知道,也许在我的php.ini文件?我和他一起工作的人尽力帮助我,但他可能根本就不知道什么。
任何帮助都不胜感激。让我知道,如果有其他信息,我可以提供。谢谢!
编辑:我也应该提一些我做的其他尝试。
1)带端口587的TLS
2)没有SSL使用端口25,80和3535
2)我自己的gmail地址修改服务器,用户名,密码等。
解决方案 看来这是一个持续的问题让我加入自己的经验。
我们的网站使用PHPMailer,该网站托管在GoDaddy的linux服务器上。 似乎的设置是正确的(根据我在SO和goDaddy支持网站上可以找到的所有内容)如下:
SMTP_SERVER:smtpout.secureserver.net(或者relay-hosting.secureserver.net) SMTP_PORT:465 //或
SMTP_AUTH:true // always
SMTP_Secure:'ssl'//只有使用端口465
花了6个多小时尝试端口的所有变体(25,),服务器relay-hosting.secureserver.net,smtpout.secureserver.net:[port]等),用户名,密码等。我叫goDaddy另外40分钟后,透露:
1)“工作区”电子邮件帐户正在退休。这很重要,因为如果您今天有一个电子邮件帐户与goDaddy,您可能有一个Workspace帐户。根据技术支持代表,这是与您的linux帐户分开托管的。
2)goDaddy正在向cPanel电子邮件帐户转移。欢呼!时间表? “...在接下来的2到3年!”
3)当我和代表打电话时,我把我们的帐户从Workspace移动到了cPanel帐户。真的很容易。
4)将您的电子邮件帐户(包括编辑MX记录)更改为cPanel电子邮件(与“工作区”电子邮件)后,使用PHPMailer的Web表单邮件的设置是:
SMTP_SERVER:localhost //(我的意思是字面意思是“localhost” - 代替smtp.secureserver.net和relay-hosting.secureserver.net等)
。 ..和其他一切(如上)一样...
我在PHPMailer构建的webform在这个变化之后完美地工作了。
在PHPMailer设置中使用您的cPaneL电子邮件帐号登录(用户名)和密码,您的网络电子邮件将无缝工作!
另外一个好处是webmail (有人使用这个吗?)可以在[yourdoman] \webmail上访问。没有更多的隐藏的url要记住!帐户可以是IMAP或POP!
诚然,这意味着您必须使用goDaddy的cPanel电子邮件帐户,但是通过PHPMailer使Webform无法正常工作是真正的回报!
本文地址: &
扫一扫关注IT屋
微信公众号搜索 “ IT屋 ” ,选择关注
与百万开发者在一起
(window.slotbydup = window.slotbydup || []).push({
id: '5828425',
container: s,
size: '300,250',
display: 'inlay-fix'
Python入门phpmailer QQ邮箱无法连接到SMTP服务器_懒人程序
支付宝赞助帐号:
phpmailer QQ邮箱无法连接到SMTP服务器
phpmailer QQ邮箱无法连接到SMTP服务器
今天在WORDPRESS上用QQ邮箱发邮件,总是提示无法连接到服务器
phpmailer error SMTP Error: Could not connect to SMTP host Could not instantiate mail function
弄了半天,原来是不同邮件系统要求的smtp请求不同,但是都允许大写,有些不支持小写,比如网易,腾讯的邮箱。
原来的设置
$mail-&SMTPAuth =
$mail-&Mailer
$mail-&Host = &smtp.qq.com&;
$mail-&Port = 25; //设置邮件服务器的端口,默认为25
$mail-&Username = &&;
$mail-&Password = &xxxxxxxxxx&;
把smtp改成大写就可以了
$mail-&Mailer
支持键盘 ← →phpmailer在服务器上不能正常发送邮件的解决办法
转载 &更新时间:日 09:11:40 & 投稿:junjie
这篇文章主要介绍了phpmailer在服务器上不能正常发送邮件的解决办法,本文的原因是服务器的安全设置造成,服务器中屏蔽fsockopen函数的使用权限,所以导致发送失败,需要的朋友可以参考下
phpmailer本身是一个很不错的开源邮件类,也非常的易用简单,就是偶尔会出现程序上传到服务器上不能发送邮件的情况,在之前也有同学问过我这个问题,当时的时候总是不以为然,今天终于让我碰上了,用phpmailer 在本地测试正常,上传到服务器上就不行了,当然了是用的SMTP方式,最终确定是fsockopen 函数惹的祸,因为安全原因fsockopen 和pfsockopen 经常被服务器端关闭。解决方法如下:
而代之的应该是 stream_socket_client()函数,不过他的参数有一点不一样。
应这样更改phpmailer 的 class.stmp.php文件:
$this-&smtp_conn = @fsockopen( $host,
// the host of the server
// the port to use
// error number if any
$errstr, // error message if any
// give up after ? secs
$this-&smtp_conn = @stream_socket_client( $host.':'.$port,
// the host of the server
// error number if any
$errstr, // error message if any
// give up after ? secs
这里 PHP版本应高于 5.0 的,因为较早版本没有stream_socket_client()函数的。
OK ,问题解决了。
您可能感兴趣的文章:
大家感兴趣的内容
12345678910
最近更新的内容
常用在线小工具本文出自汗血宝马,转载时请注明出处及相应链接。
本文永久链接: http://www.caotama.com/82253.html
Ɣ回顶部

我要回帖

更多关于 香港主机租用 的文章

 

随机推荐