【发布时间】:2011-06-01 23:59:32
【问题描述】:
我有这段代码,在我的本地服务器上一切正常。电子邮件发送没有任何问题。
但是现在我将内容传递给网络服务器,我得到了这个错误......
SMTP Error: Could not connect to SMTP host.
在服务器中启用了 SSL..正确吗?那么,问题是什么?
$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
【问题讨论】:
-
您的防火墙允许外部连接到端口 465?
-
运行这个 php 代码的服务器。
-
当然是伟大的中国防火墙。