Resolve the error "PHPMailer Error: Extension missing: openssl"
Asked Answered
M

6

5

I've removed ; for openssl from php.ini at php as well as apache folder. I still get the error "PHPMailer Error: Extension missing: openssl" The following is the php code and I've setup phpmailerautoload too.

PHP CODE:

<?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*******[email protected]";
$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*******[email protected]";
$mail->FromName = "Vignesh";

$mail->addAddress("vignesh*******[email protected]","User 1");

//$mail->addCC("[email protected]","User 3");
//$mail->addBCC("[email protected]","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";
?>

Please help me in resolving the error. I've enabled openssl in wampserver too.

Motorbus answered 17/5, 2015 at 7:26 Comment(3)
The error message says that you are missing the openssl extension... did you double check? aka, did you edit the correct ini files?Adria
Also check here, there could be some hints: #3478266Adria
edit php.ini file, remove the";" at the ";extension=php_openssl.dll"Narvaez
D
7

PHP on IIS,

1) Open (php install directory)php.ini

2) Uncomment (~ line 910 in php.ini) extension=php_openssl.dll

3) Restart IIS

Debonair answered 14/12, 2017 at 4:47 Comment(1)
Nope didnt work. None of these suggestions worked. Im using Windows 10 and PHP 7.4.10Aurea
V
2

For Windows + Apache:

In PHP.INI, un-comment extension=php_openssl.dll.

In Apache\bin, add libeay32.dll and ssleay32.dll. (Skipping this step causes Apache startup to twice say The ordinal 3906 could not be located in the dynamic link library LIBEAY32.dll.)

Restart Apache.

The next step is getting the SSL stuff working - TLS versus SSL, port number, authentication ...

Voncile answered 1/12, 2016 at 23:59 Comment(0)
H
1

change ;extension=php_openssl.dll to extension=php_openssl.dll in your php.ini file. then restart your webbrowser and wamp/xampp server. hope this helps.

Hogan answered 17/1, 2017 at 18:25 Comment(0)
H
0

In addition to what you did and what @Bilbo said, you might want to change the value form extension_dir in your php.ini to an absolute path (instead of the relative default). Not sure why, but that did the trick for me.

In your php.ini find and change extension_dir = "ext" to something like this: extension_dir = "c:/php710/ext". Your path may vary!

Honest answered 16/1, 2017 at 20:14 Comment(0)
A
0

1) Open (php install directory) php.ini
Tip: If you can't find your php.ini you can create a php file and run it as follows:

$inipath = php_ini_loaded_file();
 if ($inipath) {
      echo 'Loaded php.ini: ' . $inipath;
 } else {
      echo 'A php.ini file is not loaded';
 }

This will tell you where your php.ini or if you dont have one loaded.
Tip: php comes with a production and development php.ini if you need one.

2) Uncomment (~ line 910 in php.ini)
Pre 7.4.2: extension=php_openssl.dll
7.4.2: extension=openssl

3) Uncomment extension_dir = "ext" (~line 761 in php.ini)

4) Restart IIS

Assuasive answered 24/3, 2020 at 16:59 Comment(0)
A
0

in my case the problem was the space in the path of "ext" dir: c:/Program files/php-5.4.36/exe.

Once changed, the ext dir to a "solid" path (simply copying into a place having a path without spaces inside) and phpmail (PHPMailer->SMTPSecure("tls")) works perfectly fine!

Obviously in the php.ini file, the row extension=php_openssl.dll is to be uncommented!

Curiously, after this work through, the execution of the command line scripts only resumed after restarting the command shell (cmd).

Acceleration answered 16/10, 2021 at 20:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.