我正在尝试为我的网站设置身份验证电子邮件。我不需要任何花哨或安全的东西,但我在试图让它发挥作用时遇到了巨大的麻烦。
这是我的PHP
function emailconfirmation($temppass, $emailaddress) {
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 1;
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'tls';
$mail->Host = 'smtp.gmail.com';
$mail->Port = 587;
$mail->Username = 'myEmail@gmail.com';
$mail->Password = 'myGmailPassword';
$mail->SetFrom('myEmail@gmail.com');
$mail->AddAddress($emailaddress);
$mail->Subject = 'Test';
$mail->Body = 'test authentication key: ' . $temppass;
if(!$mail->send()) {
return 'Error: ' . $mail->ErrorInfo;
} else {
return true;
}
}
这是它不断吐出的错误
2013-09-14 22:43:13 CLIENT -> SERVER: EHLO www.mydomain.com 2013-09-14 22:43:13 CLIENT -> SERVER: STARTTLS
Warning: stream_socket_enable_crypto(): this stream does not support SSL/crypto in C:\wamp\bin\php\includes\PHPMailer-master\class.smtp.php on line 274
2013-09-14 22:43:13 CLIENT -> SERVER: QUIT 2013-09-14 22:43:13 SMTP ERROR: QUIT command failed: SMTP connect() failed.
你们能提供的任何帮助都会很棒。仅供参考,我已经允许端口 587 通过我的防火墙,并且我发送的电子邮件与我发送的电子邮件不同。谢谢!
编辑:说真的,没人吗?这真的让我很紧张