Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Jul 2008
    Posts
    17
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Unable to find socket transport ssl while using PHPMailer

    Hi folks,

    I keep getting the following message when I try to run a php script trying to send email through gmail:

    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?) in C:\phpmailer\class.smtp.php on line 124
    Mailer Error: SMTP Error: Could not connect to SMTP host.


    The common solution on the web seems to be to uncomment the php_openssl.dll extension in php.ini but I've already done that and restarted my Apche webserver with no luck. I should add that stream_get_transports() only returns tcp and udp. Can someone please help? Here is the PHP script I'm using:

    include("C:\phpmailer\class.phpmailer.php");

    $mail= new PHPMailer();
    $mail->Mailer="smtp";
    $mail->Host = "ssl://smtp.gmail.com";
    $mail->Port = 465;
    $mail->IsSMTP(); // send via SMTP
    $mail->SMTPAuth = true; // turn on SMTP authentication
    $mail->Username = "satsujin@gmail.com"; // SMTP username
    $mail->Password = "passwd"; // SMTP password
    $webmaster_email = "satsujin@gmail.com"; //Reply to this email ID
    $email="anoopm@shabiagroup.com"; // Recipients email ID
    $name="AnoopM"; // Recipient's name
    $mail->From = $webmaster_email;
    $mail->FromName = "Satsujin";
    $mail->AddAddress($email,$name);
    $mail->AddReplyTo($webmaster_email,"Webmaster");
    $mail->WordWrap = 50; // set word wrap
    //$mail->AddAttachment("/var/tmp/file.tar.gz"); // attachment
    //$mail->AddAttachment("/tmp/image.jpg", "new.jpg"); // attachment
    $mail->IsHTML(true); // send as HTML
    $mail->Subject = "This is the subject";
    $mail->Body = "Hi,
    This is the HTML BODY "; //HTML Body
    $mail->AltBody = "This is the body when user views in plain text format"; //Text Body
    if(!$mail->Send())
    {
    echo "Mailer Error: " . $mail->ErrorInfo;
    }
    else
    {
    echo "Message has been sent";
    }

  • #2
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,011
    Thanks
    2
    Thanked 312 Times in 304 Posts
    Use a phpinfo(); statement in a .php file to check if the openssl extension actually loaded.
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #3
    New Coder
    Join Date
    Jul 2008
    Posts
    17
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Hmm the Apache environment SERVER_SOFTWARE section has this:

    Apache/2.2.9 (Win32) DAV/2 mod_ssl/2.2.9 OpenSSL/0.9.8h mod_autoindex_color PHP/5.2.6

    but OpenSSL itself doesnt seem to have a section in the phpinfo() list. Any idea why? IT's specified as an extension in php.ini and the dll exists in the extension directories.

  • #4
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,011
    Thanks
    2
    Thanked 312 Times in 304 Posts
    Check your web server error log file for related errors. If there is no error related to openssl, then it is likely the first possibility in the following. If there is an error about not being able to load a .dll, the it is like the second possibility in the following.

    Two possibilities come to mind -

    The php.ini that you are changing is not the one that php is using, or

    The auxiliary .dll file that openssl uses - libeay32.dll is either not present or it is not present in a folder that is on the Windows PATH statement. This file is usually in the php folder and the normal method of installing php is to add the php folder to the Windows PATH statement (reboot your computer to get any changes made to the Windows PATH statement to take effect.)
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #5
    New Coder
    Join Date
    Jul 2008
    Posts
    17
    Thanks
    1
    Thanked 0 Times in 0 Posts
    hmm you were right. My libeay32.dll was in my C:\xampp\php folder which was not in the PATH variable. However, I added that to the variable and reset my computer with the results still the same. I'm pretty sure i'm editing the right php.ini ( both that file and php5.ini in my php folder have that extension active) but is there some way to be sure? Or do I need to add some files to the Windows\System32 dir?

  • #6
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,011
    Thanks
    2
    Thanked 312 Times in 304 Posts
    The phpinfo() output contains a line in the first section that states what php.ini is getting loaded -

    Code:
    Loaded Configuration File xxxxxxxx
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #7
    New Coder
    Join Date
    Jul 2008
    Posts
    17
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thank you, thank you, thank you! I was editing the php.ini in xampp/php but the one being used was in xampp/apache/bin. Phew! Finally....It was just lack of knowledge on my part but thank you again for leading me to the answer.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •