PHPMailer发生SMTP错误 [英] SMTP error with PHPMailer

查看:239
本文介绍了PHPMailer发生SMTP错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到SMTP错误:无法连接到SMTP主机。尝试使用GMAIL SMTP和PHPMailer发送邮件时发生错误。

I am getting "SMTP Error: Could not connect to SMTP host." error while trying to send mails using GMAIL SMTP and PHPMailer..

该代码在本地环境中运行正常,但在live(bluehost)服务器中出现错误。请帮助

The code is working perfectly in local environment but getting error in live (bluehost) server.. Please help

推荐答案

Bluehost不允许gmail SMTP连接

引用文章: strong>

Quoting article:

根据bluehost,您无法通过托管在bluehost上的Web应用程序通过SMTP连接发送电子邮件。它们只允许通过自己的SMTP服务器发送。

According to bluehost, you cannot send emails through SMTP connections from web applications hosted on bluehost. They only allow sending through their own SMTP servers.

这项工作是在Bluehost中设置与Google Apps中使用的电子邮件相同的电子邮件帐户。然后我修改了Magento中的代码,使用bluehost的SMTP服务器发送:

The work around is that I setup a email account in Bluehost the same as the email I use in Google Apps. I then modified the code in Magento to send out using bluehost’s SMTP servers:

例如:

发送邮件服务器:(SSL)boxnumber.bluehost.com(服务器需要身份验证)
支持的传入邮件协议:

Outgoing Mail Server: (SSL) boxnumber.bluehost.com (server requires authentication) Supported Incoming Mail Protocols:

* POP3: port 110
* POP3S (SSL/TLS): port 995
* IMAP: port 143
* IMAPS (SSL/TLS): port 993

支持的外发邮件协议:

* SMTP: port 26
* SMTPS (SSL/TLS): port 465

它将电子邮件发送给客户,并使用从bluehost的本地SMTP服务器发送的正确的电子邮件地址,因此当客户回复电子邮件地址时,它将在我的Google应用程序邮箱中。

And it works, it sends the email out to the customers with the right email address sent from bluehost’s local SMTP servers, so when customers reply to the email address it will arrive in my google apps mail box.

这篇关于PHPMailer发生SMTP错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆