SMTP Error: Could not connect to SMTP host

Discussion in 'PHP' started by tiizy, Jul 14, 2011.

  1. #1
    I am new to php and working on a project where i am required to send an email(using my gmail id) to the user as soon as he fill up the specified form.
    I have tried almost every possible answer that i accessed online but still have not found a solution to it.
    Following is the code that i am using-


    require_once("PHPMailerclass.phpmailer.php");
    $mail= new PHPMailer();
    $mail->IsSMTP();
    $mail->SMTPAuth=true;
    $mail->SMTPSecure="ssl";
    $mail->Host="//smtp.gmail.com";
    $mail->Port=465;
    $mail->Username="xyz@gmail.com";
    $mail->Password="*********";


    $mail->From="xyz@gmail.com";
    $mail->FromName="abc ";
    $mail->Subject="Complaint register confirmation";
    $mail->MsgHTML("Hello !

    Your comlpaint has been registered. We will try to solve it as soon as possible.
    ");
    $mail->AddAddress($b); // $b is the email address of the user
    //that is fetched from the form filled up by the user
    $mail->IsHTML(true);
    $mail->Send();



    I am using XAMPP 1.7.4 that has PHP 5.3.5 in it.
    I have already changed the settings php.ini i.e.
    SMTP=smtp.gmail.com and
    smtp_port=465
    but could not find "extension=php_openssl.dll". so i added it on my own. I have also overwritten "libeay32.dll" and "ssleay32.dll" in "C:xampp\apache\bin" and restarted services everytime i made changes.
    It is still not working and giving following error-
    " SMTP Error: Could not connect to SMTP host."

    I dont know how to check my smtp is working or not, so haven't checked it yet...
    kindly provide me with some help...

    Thanks in advance
     
    tiizy, Jul 14, 2011 IP