我想在用户注册后向用户发送确认电子邮件。我正在使用 xampp。当我运行我的 php 文件时,它返回以下错误:
Warning: fsockopen() [function.fsockopen]: unable to connect to ssl://smtp.gmail.com:465 (Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?) in C:\xampp\htdocs\class.smtp.php on line 122
Warning: fsockopen() [function.fsockopen]: unable to connect to ssl://smtp.gmail.com:465 (Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?) in C:\xampp\htdocs\class.smtp.php on line 122
Message has not been sent.
我的 php 文件中的相关部分:
try
{
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Mailer = "smtp";
$mail->SMTPSecure = "ssl";
$mail->Host = "ssl://smtp.gmail.com";
$mail->Port = 465;
$mail->SMTPAuth = true;
$mail->CharSet="utf-8";
$mail->Username = "user@gmail.com";
$mail->Password = "password";
$mail->From = "user@gmail.com";
$mail->FromName="DBE Yazılım";
$mail->AddAddress($_POST['UserMail']);
$mail->Subject = "Registration Information";
$mail->Body = "Hello your password is " . $userpass;
//$mail->AddAttachment($path);
$mail->Send();
if($mail->Send())
echo 'Message has been sent.';
else
echo 'Message has not been sent.';
}
catch(Exception $e)
{
echo 'hata'.$e->getMessage();
}
我看过论坛,这个错误通常是关于 ssl 的。他们说extension=php_openssl.dll
必须添加到php.ini中。我添加了这部分,但没有任何改变。这是关于 xampp 的吗?
提前致谢。