2012-07-18 2 views
2

Je souhaite envoyer un e-mail de confirmation à l'utilisateur lorsque l'utilisateur s'est enregistré. J'utilise xampp. Quand je lance mon fichier php, il renvoie l'erreur suivante:erreur fsockopen() à propos de l'envoi de courrier php

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. 

partie associée dans mon fichier php:

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(); 
    } 

J'ai regardé les forums et cette erreur est généralement d'environ ssl. Ils disent que extension=php_openssl.dll doit ajouter dans php.ini. J'ai ajouté cette partie mais tout n'a pas changé. Est-ce à propos de xampp?

Merci d'avance.

Répondre

2

Comme vous pouvez le voir dans le message d'erreur

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

il y a une ssl:// trop

$mail->Host = "smtp.gmail.com"; // instead of ssl://smtp.gmail.com 

Habituellement, si vous voyez le terme « hôte », cela signifie vraiment « host » et non un url

+0

j'ai changé pour "$ mail-> Host =" smtp.gmail.com ";" mais l'erreur ne change pas. – rockenpeace