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*******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";
?>

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

Vignesh Anandakumar
  • 167
  • 1
  • 3
  • 12
  • The error message says that you are missing the openssl extension... did you double check? aka, did you edit the correct ini files? – Masiorama May 17 '15 at 07:47
  • Also check here, there could be some hints: http://stackoverflow.com/questions/3477766/phpmailer-smtp-error-could-not-connect-to-smtp-host?rq=1 – Masiorama May 17 '15 at 07:48
  • 1
    edit php.ini file, remove the";" at the ";extension=php_openssl.dll" – kyorilys Jul 21 '16 at 10:09

6 Answers6

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

atazmin
  • 4,757
  • 1
  • 32
  • 23
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 ...

Bilbo
  • 358
  • 1
  • 10
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.

Verma Aman
  • 149
  • 14
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!

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

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

Skully
  • 2,882
  • 3
  • 20
  • 31