VTXmom Posted February 25, 2015 Share Posted February 25, 2015 (edited) I have created a contact form that sends an email when the user clicks the send button on the form. It acts like it is sending but then eventually times out with this message, "Warning: stream_socket_enable_crypto(): this stream does not support SSL/crypto in C:\xampp-win32-1.8.3-5-VC11\xampp\htdocs\pet-shop\class.smtp.php on line 338". I have searched the forums and so far have not found any other posts on this. Can someone look at my php code and tell me if they see anything wrong? I got the settings from the gmail example in the phpmailer folder. This is for a class assignment, here is my php code: <?php $email = $_REQUEST['email'] ; $message = $_REQUEST['message'] ; // here we use the php mail function // to send an email to: // you@yourdomain.com mail( "aughinbaughtestemail@gmail.com", "Contact Us",$message, "From: $email" ); ?> <?php date_default_timezone_set('Etc/UTC'); require 'PHPMailerAutoLoad.php'; $mail = new PHPMailer(); $mail->IsSMTP(); $mail->STMPDebug = 2; $mail->Debugoutput = 'html';; $mail->Host = "smtp.gmail.com"; $mail->Port = 587; $mail->SMTPSecure = 'tls'; $mail->SMTPAuth = true; $mail->Username = "aughinbaughtestemail@gmail.com"; $mail->Password = "******"; $mail->From = $email; $mail->setFrom('aughinbaughtestemail@gmail.com','First Last'); $mail->addReplyTo('aughinbaughtestemail@gmail.com', 'First Last'); $mail->AddAddress('aughinbaughtestemail@gmail.com', 'Andrea Aughinbaugh'); $mail->Subject = 'PHPMailer Gmail SMTP test'; $mail->AltBody = 'This is a plain-text message body'; $message = $_REQUEST['message'] ; $mail->Body = $message; $mail->AltBody = $message; if(!$mail->Send()) { echo "Message could not be sent. <p>"; echo "Mailer Error: " . $mail->ErrorInfo; exit; } echo "Message has been sent"; ?> Thanks for all the help I have been receiving with this project, I know I must look like a bit of a dummy. I just noticed in the bottom left corner it says "waiting for localhost", don't know if that helps. Edited February 25, 2015 by VTXmom Quote Link to comment Share on other sites More sharing options...
QuickOldCar Posted February 25, 2015 Share Posted February 25, 2015 Edit your php.ini file this line: ;extension=php_openssl.dll to this: extension=php_openssl.dll Restart server and then try it. Quote Link to comment Share on other sites More sharing options...
VTXmom Posted February 25, 2015 Author Share Posted February 25, 2015 Thank you for helping, that line does not appear in my php.ini file, do I need to add it, if so, does it go under mail function? I need manage to get rid of the error by changing the host to localhost, but now I am getting an SMTP error. In looking around I also found that SMTP is deactivated in XAMPP and I can find no instructions on how to activate it. Can anyone tell me how to activate it? Quote Link to comment Share on other sites More sharing options...
QuickOldCar Posted February 25, 2015 Share Posted February 25, 2015 I see you are using gmail as a relay, in this case you don't need smtp You do need the openssl enabled though. Quote Link to comment Share on other sites More sharing options...
VTXmom Posted February 25, 2015 Author Share Posted February 25, 2015 Thank you QuickOldCar, that worked! Now on to my next problem, this site has been a God-send, I have three days to finish this assignment and I am starting to panick a bit . Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.