title: fsockopen(): unable to connect to ssl://smtp.googlemail.com:465 (Connection refused) on live server godaddy. its work on localhost
body: <p>I have following function which works on localhost but it does't work on live server godaddy.
  It throws warning : </p>
  
  <blockquote>
    <p>fsockopen(): unable to connect to ssl://smtp.googlemail.com:465
    (Connection refused)</p>
  </blockquote>
  
  <p>This is my model function</p>
  
  <pre><code>  public function check()
      {
          $name   = 'sangram';
          $email  = 'sangram.preciseit@gmail.com';
          $phone  = '12456789';
          $message= 'testing';
  
          $to = 'sangram.preciseit@gmail.com';
          $sub = 'Enquiry';
          $msg="&lt;p&gt;Name:$name&lt;/p&gt;&lt;p&gt;Email: $email&lt;/p&gt;&lt;p&gt;Contact Number: $phone&lt;/p&gt;&lt;p&gt;Message: $message&lt;/p&gt;";
  
          $configGmail = array();
          $configGmail['protocol']        = 'smtp';
          $configGmail['smtp_host']    = 'ssl://smtp.googlemail.com';
          $configGmail['smtp_port']    = '465';
          $configGmail['mailtype']        = 'html';
          $configGmail['charset']     = 'utf-8';
          $configGmail['newline']     = "\r\n";
  
          // new mailid chnaged on 1st-dec-2016
          $configGmail['smtp_user']    = 'emailaddress@gmail.com';
          $configGmail['smtp_pass']    = 'mypassword';
  
          $configGmail['wordwrap']    = TRUE;
  
          $this-&gt;load-&gt;library('email');
          $this-&gt;email-&gt;initialize($configGmail);
  
          $this-&gt;email-&gt;from('emailaddress@gmail.com',"XYZ");
  
          $this-&gt;email-&gt;to($to);
          $this-&gt;email-&gt;subject($sub);
          $msg    =   $msg;
          $this-&gt;email-&gt;message($msg);
  
          if($this-&gt;email-&gt;send())
          {
              echo "mail send";
          }
          else{
              echo "mail not send";
          }
      }
  </code></pre>
  
  <p>Please tell me what should i do?
  Thanks in advance</p>