解决错误“ PHPMailer错误:缺少扩展名:openssl”

Vig*_*mar 2 php phpmailer

我已经搬走了; 从php以及apache文件夹中的php.ini获取openssl。我仍然收到错误“ PHPMailer错误:缺少扩展名:openssl”以下是php代码,并且我也设置了phpmailerautoload。

PHP代码:

<?php
require "PHPMailerAutoload.php";
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Mailer = 'smtp';
$mail->SMTPAuth = true;
$mail->Host = 'smtp.gmail.com'; // "ssl://smtp.gmail.com" didn't worked
$mail->Port = 465;
$mail->SMTPSecure = 'ssl';
// or try these settings (worked on XAMPP and WAMP):
/*$mail->Port = 587;
$mail->SMTPSecure = 'tls';*/


$mail->Username = "vignesh*******45@gmail.com";
$mail->Password = "********";

$mail->IsHTML(true); // if you are going to send HTML formatted emails
$mail->SingleTo = true; // if you want to send a same email to multiple users. multiple emails will be sent one-by-one.

$mail->From = "vignesh*******45@gmail.com";
$mail->FromName = "Vignesh";

$mail->addAddress("vignesh*******45@gmail.com","User 1");

//$mail->addCC("user.3@ymail.com","User 3");
//$mail->addBCC("user.4@in.com","User 4");

$mail->Subject = "Testing PHPMailer with localhost";
$mail->Body = "Hi,<br /><br />This system is working perfectly.";

if(!$mail->Send())
    echo "Message was not sent <br />PHPMailer Error: " . $mail->ErrorInfo;
else
    echo "Message has been sent";
?>
Run Code Online (Sandbox Code Playgroud)

请帮助我解决错误。我也在wampserver中启用了openssl。

ata*_*min 6

IIS上的PHP,

1)打开(php安装目录)php.ini

2)取消注释(〜php.ini中的第910行)extension = php_openssl.dll

3)重新启动IIS


Bil*_*lbo 2

对于 Windows + Apache:

在 PHP.INI 中,取消注释extension=php_openssl.dll.

在 Apache\bin 中,添加libeay32.dllssleay32.dll。(跳过这一步会导致Apache启动两次说The ordinal 3906 could not be located in the dynamic link library LIBEAY32.dll.

重新启动阿帕奇。

下一步是让 SSL 工作起来——TLS 与 SSL、端口号、身份验证……