Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php SMTP Gmail服务器SSL错误_Php_Ssl_Smtp - Fatal编程技术网

Php SMTP Gmail服务器SSL错误

Php SMTP Gmail服务器SSL错误,php,ssl,smtp,Php,Ssl,Smtp,我用这个编码用gmail发送邮件,但我得到了下面的错误,这里当我删除ssl部分,它的工作,但我力不接收任何电子邮件(检查内部垃圾邮件也)。还有其他问题吗 $mail = new phpmailer; $mail->IsSMTP(); // telling the class to use SMTP $mail->SMTPDebug = 1;// enables SMTP debug information (for testing) $mail->SMTPAuth = tru

我用这个编码用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";
}

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

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