title: phpmailer script, Could not connect to SMTP host
body: <p>I want to send email from "dalalakhras20@gmail.com" to "dakhras@mcst.edu.sa" using phpmailer script.</p>
  
  <p>This is my code:</p>
  
  <pre><code>&lt;?php
  require_once("PHPMailer/class.phpmailer.php");
  $mail=new PHPMailer();
  $mail-&gt;IsSMTP();
  $mail-&gt;SMTPAuth = true;
  $mail-&gt;SMTPSecure = "ssl";
  $mail-&gt;Host = "smtp.gmail.com"; //not ssl://smtp.gmail.com
  $mail-&gt;Port = 465; 
  
  
  $mail-&gt;SetFrom = "dalalakhras20@gmail.com";
  $mail-&gt;AddAddress("dakhras@mcst.edu.sa");
  
  $mail-&gt;Subject = "aaa";
  $mail-&gt;Body = "bbb";
  $mail-&gt;WordWrap = 50;
  
  if(!$mail-&gt;Send())
  {
     echo 'Message was not sent.';
     echo 'Mailer error: ' . $mail-&gt;ErrorInfo;
  } 
  else 
  {
    echo "Message Sent!";
  }
  ?&gt;
  </code></pre>
  
  <p>in php.ini I set the following:</p>
  
  <pre><code>[mail function]
  ; For Win32 only.
  SMTP = ssl://smtp.gmail.com             
  smtp_port = 465
  
  
  ; For Win32 only.
  sendmail_from = dalalakhras20@gmail.com
  </code></pre>
  
  <p>I did not change any thing in the class.phpmailer.php file.</p>
  
  <p>I got this error:</p>
  
  <pre><code>SMTP Error: Could not connect to SMTP host. Message was not sent.Mailer error: SMTP Error: Could not connect to SMTP host.  
  </code></pre>
  
  <p>I am using Apache2.2, any one can help me?</p>