Vignesh Anandakumar
Vignesh Anandakumar

Reputation: 167

Resolve the error "PHPMailer Error: Extension missing: openssl"

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.

Upvotes: 5

Views: 39943

Answers (6)

Amadio Sacripanti
Amadio Sacripanti

Reputation: 1

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).

Upvotes: 0

TheBoredMage
TheBoredMage

Reputation: 1

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

Upvotes: 0

atazmin
atazmin

Reputation: 5687

PHP on IIS,

1) Open (php install directory)php.ini

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

3) Restart IIS

Upvotes: 7

Verma Aman
Verma Aman

Reputation: 159

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.

Upvotes: 1

user7363501
user7363501

Reputation: 31

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!

Upvotes: 0

Bilbo
Bilbo

Reputation: 380

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 ...

Upvotes: 2

Related Questions