【问题标题】:SMTP Gmail Server SSL ErrorSMTP Gmail 服务器 SSL 错误
【发布时间】:2011-12-29 13:57:46
【问题描述】:

我使用此编码使用 gmail 发送邮件,但收到以下错误,当我删除 ssl 部分时,它可以正常工作,但我没有收到任何电子邮件(也在垃圾邮件中检查)。还有什么问题吗?

$mail = new phpmailer;
$mail->IsSMTP(); // telling the class to use SMTP
$mail->SMTPDebug = 1;// enables SMTP debug information (for testing)
$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 for the GMAIL server
$mail->Username  = "un"; // GMAIL username
$mail->Password = "pwd"; // GMAIL password
$mail->SetFrom('test@gmail.com', 'Bharanidharan');
$mail->AddReplyTo("test@gmail.com","Vishal Kumar");
$mail->AddAddress("test@gmail.com","Bharani");
$mail->Subject = "Hey, check out";
$body = "hey, check email";
$mail->MsgHTML($body);
$address = "test@gmail.com";
$mail->AddAddress($address, "test");
if(!$mail->Send())
{
echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
echo "Message has been sent";
}

【问题讨论】:

  • 实际的错误信息在哪里?
  • SMTP -> 错误:无法连接到服务器:无法找到套接字传输“ssl” - 您在配置 PHP 时是否忘记启用它? (72165504) SMTP 错误:无法连接到 SMTP 主机。邮件程序错误:SMTP 错误:无法连接到 SMTP 主机。

标签: php ssl smtp


【解决方案1】:

在 Apache 中启用 mod_ssl(搜索配置文件)和 openssl PHP 扩展(检查 php.ini)

【讨论】:

    猜你喜欢
    • 2015-03-13
    • 1970-01-01
    • 2015-08-02
    • 2014-12-08
    • 1970-01-01
    • 2018-09-25
    • 2017-03-10
    • 2013-02-15
    • 1970-01-01
    相关资源
    最近更新 更多