fsockopen() error about sending mail in php
11,301
As you can see in the error message
unable to connect to ssl://ssl://smtp.gmail.com:465 (Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?) in C:\xampp\htdocs\class.smtp.php on line 122
there is one ssl://
too much
$mail->Host = "smtp.gmail.com"; // instead of ssl://smtp.gmail.com
Usually if you see the term "host", this really means "host" and not an url
Author by
rockenpeace
Updated on June 04, 2022Comments
-
rockenpeace almost 2 years
I want to send a confirmation e-mail to user when the user has registered. I am using xampp. When I run my php file, it returns the following error:
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:\xampp\htdocs\class.smtp.php on line 122 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:\xampp\htdocs\class.smtp.php on line 122 Message has not been sent.
Related part in my php file :
try { require("class.phpmailer.php"); $mail = new PHPMailer(); $mail->IsSMTP(); $mail->Mailer = "smtp"; $mail->SMTPSecure = "ssl"; $mail->Host = "ssl://smtp.gmail.com"; $mail->Port = 465; $mail->SMTPAuth = true; $mail->CharSet="utf-8"; $mail->Username = "[email protected]"; $mail->Password = "password"; $mail->From = "[email protected]"; $mail->FromName="DBE Yazılım"; $mail->AddAddress($_POST['UserMail']); $mail->Subject = "Registration Information"; $mail->Body = "Hello your password is " . $userpass; //$mail->AddAttachment($path); $mail->Send(); if($mail->Send()) echo 'Message has been sent.'; else echo 'Message has not been sent.'; } catch(Exception $e) { echo 'hata'.$e->getMessage(); }
I have looked at forums and this error is generally about ssl. They say that
extension=php_openssl.dll
must add into php.ini. I added this part but anything did not change. Is this about xampp?Thanks in advance.
-
rockenpeace almost 12 yearsi have changed to "$mail->Host = "smtp.gmail.com";" but error din't change.