我有以下代码
phpinfo();
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->SMTPSecure = "ssl";
$mail->Host = "smtp.gmail.com"; // SMTP server
$mail->Port = 465;
$mail->SMTPAuth = true;
$mail->Username= 'someone@gmail.com';
$mail->Password='xxx';
$mail->From = "someone@gmail.com";
$mail->AddAddress("abc@gmail.com");
$mail->Subject = "First PHPMailer Message";
$mail->Body = "Hi! \n\n This is my first e-mail sent through PHPMailer.";
$mail->WordWrap = 50;
if(!$mail->Send()) {
echo 'Message was not sent.';
echo 'Mailer error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent.';
}
我还在 php.ini 文件中启用了“extension=php_openssl.dll”。
但它仍然给我一个错误,
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?)
Mailer error: SMTP Error: Could not connect to SMTP host.
虽然我extension=php_openssl.dll
在我的 php.ini 文件中启用了 phpinfo(); 表明这OpenSSL support:disabled (install ext/openssl)
怎么可能?
谁能帮忙??