title: Message: mail() [function.mail]: Failed to connect to mailserver at "ssl://googlemail.com" port 465
body: <blockquote>
    <p>//Does anyone knows how I get this fixed. I have already uncommented necessary files on php.ini but to no avail i still get errors and i am using xampp as my localhost.</p>
  </blockquote>
  
  <pre><code>//emails.php
  function email(){
      $this-&gt;load-&gt;model('user');
      $emails=$this-&gt;user-&gt;get_emails();
      $this-&gt;load-&gt;library('email');
      $config['mailtype']='html';
      $this-&gt;email-&gt;initialize($config);
      foreach($emails as $row){
          $email_config = Array(
          'protocol'  =&gt; 'smtp',
          'smtp_host' =&gt; 'ssl://smtp.googlemail.com',
          'smtp_port' =&gt; '465',
          'smtp_user' =&gt; 'dirk@gmail.com',
          'smtp_pass' =&gt; 'dirk',
          'mailtype'  =&gt; 'html',
          'starttls'  =&gt; true,
          'newline'   =&gt; "\r\n"
      );
      $this-&gt;load-&gt;library('email', $email_config);
  
          if($row['email']){
              $this-&gt;email-&gt;from('dirk@gmail.com', 'dirk');
              $this-&gt;email-&gt;to($row['email']);
              $this-&gt;email-&gt;subject('Test Newsletter');
              $this-&gt;email-&gt;message('Your email message goes here! &lt;strong&gt;Bold&lt;/strong&gt;');
              $this-&gt;email-&gt;send();
              $this-&gt;email-&gt;clear();
          }
      }
  }
  //user.php
  function get_emails(){
      $this-&gt;db-&gt;select('email')-&gt;from('users');
      $query = $this-&gt;db-&gt;get();
      return $query-&gt;result_array();  
  }
  </code></pre>