我遇到一个问题,我无法通过我的gmail服务器使用我的phpmailer()发送邮件。我能知道这个问题吗?
这是我的phpmailer代码:
if($count){
echo "<p>New user record has been successfully inserted.</p>\n";
require_once("PHPMailer-master/class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 0;
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'tls';
$mail->Host = "smtp.gmail.com";
$mail->Port = 587;
$mail->IsHTML(true);
$mail->Username = "";
$mail->Password = "";
$mail->SetFrom("testnoreply@gmail.com", 'Gold Fish');
$mail->Subject = "Registration Successful";
$mail->Body = "Welcome to Gold Hotel Event. Your registration have been received. It still processing now! Thank you.";
$mail->AddAddress($userEmail);
if (!$mail->Send()) {
echo "Mailer Error: " .$mail->ErrorInfo;
} else {
echo "Mail has been sent";
echo "<br>";
echo "<br>";
}
} else {
echo "<p>Insertion failed.</p>\n";
}
我也遇到了这个问题:
Warning: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed in
答案 0 :(得分:0)
您是否取消注释了extension=php_openssl.dll
文件中的行php.ini
。 Gmail使用openssl,php文件需要识别。