我有这段代码,并且在我的本地服务器上一切正常。电子邮件已发送,没有任何问题。
但现在我将内容传递给网络服务器,我收到此错误......
SMTP Error: Could not connect to SMTP host.
SSL is enable in the server..correct? so, what is the problem?
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 465; // set the SMTP port
$mail->Username = "dnteiro"; // GMAIL username
$mail->Password = "xxx"; // GMAIL password
听起来您的网络主机正在阻止到 smtp.gmail.com:465 的出站连接。建议:
验证:如果您可以通过 shell/终端访问您的网络托管服务器,请尝试 telnet 测试验证他们实际上正在阻止此操作. Run telnet smtp.gmail.com 465
联系方式:致电或发送电子邮件给您的托管提供商,了解他们为出站中继提供的 SMTP 服务器。确保他们知道您想使用您的@gmail.com
地址作为发件人/回复地址。
更新代码:一旦您的主机为您提供了不同的邮件服务器,请更新您的代码并重试。
如果您的网络主机根本不允许从其服务器进行出站中继,那么您需要考虑切换主机(如果您的应用程序有此要求)。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)