0

I'm trying to set up authentication emails for my website. I don't need anything fancy or secure, but I'm having massive troubles trying to get this to work.

Here is my PHP

function emailconfirmation($temppass, $emailaddress) {
    $mail = new PHPMailer();
    $mail->IsSMTP();
    $mail->SMTPDebug = 1;
    $mail->SMTPAuth = true;
    $mail->SMTPSecure = 'tls';
    $mail->Host = 'smtp.gmail.com';
    $mail->Port = 587;
    $mail->Username = 'myEmail@gmail.com';
    $mail->Password = 'myGmailPassword';
    $mail->SetFrom('myEmail@gmail.com');
    $mail->AddAddress($emailaddress);
    $mail->Subject = 'Test';
    $mail->Body    = 'test authentication key: ' . $temppass;
    if(!$mail->send()) {
        return 'Error: ' . $mail->ErrorInfo;
    } else {
        return true;
    }
}

And here is the error it keeps spitting out

2013-09-14 22:43:13 CLIENT -> SERVER: EHLO www.mydomain.com 2013-09-14 22:43:13 CLIENT -> SERVER: STARTTLS
Warning: stream_socket_enable_crypto(): this stream does not support SSL/crypto in C:\wamp\bin\php\includes\PHPMailer-master\class.smtp.php on line 274
2013-09-14 22:43:13 CLIENT -> SERVER: QUIT 2013-09-14 22:43:13  SMTP ERROR: QUIT command failed: SMTP connect() failed.

Any help that you guys can provide would be great. FYI, I've allowed the port 587 through my firewall, and the email I'm sending to is not the same as the one I'm sending from. Thanks!


EDIT: Seriously, nobody? This is really getting on my nerves

  • It looks like you are missing SSL support in your PHP installation. Without it you won't have success, even if you don't think you need security. – Sven Sep 14 '13 at 23:15
  • okay, so I uncommented extension=php_openssl.dll in my php.ini because of some tips on how to install SSL. Now there is no error, but the page just hangs – Lampitosgames Sep 15 '13 at 00:01

1 Answers1

0

You need to enable OpenSSL in your WAMP setup.

I see you uncommented this line: extension=php_openssl.dll which is good, but apparently Wampserver with apache 2.4.4 released with wrong OpenSSL files!

Per this other StackOverflow response you should Download an install the Win32 OpenSSL files yourself.

Then stop WAMP, take these files from your newly installed OpenSSL directory:

bin\openssl.cfg
bin\libeay32.dll
bin\ssleay32.dll
bin\openssl.exe

copy them over these files in your WAMP/Apache directory:

conf\openssl.cnf (rename the openssl.cfg file to openssl.cnf to overwrite this)
bin\libeay32.dll
bin\ssleay32.dll
bin\openssl.exe

Finally, Start WAMP.

Community
  • 1
  • 1
Matt Pavelle
  • 819
  • 5
  • 8