title: An Error Was Encountered simple mail sending localhost to server not working
body: <p>My Code :</p>
  
  <pre><code>&lt;?php
  
  class Email extends CI_Controller
  {
  
  function index()
  {
  
          $this-&gt;load-&gt;library('email');
  
          $config = Array(
  
              'protocol' =&gt; 'smtp',
              'smtp_host' =&gt; 'ssl://smtp:gmail.com',
              'smtp_port' =&gt; '465',
              'smtp_user' =&gt; 'v@gmail.com',
              'smtp_pass' =&gt; 'facebook@123',
              'charset'   =&gt;  'utf-8',
              'newline'=&gt;"\r\n"
          );
  
  
  
          $this-&gt;email-&gt;initialize($config);
  
          $this-&gt;email-&gt;set_newline("\r\n");
  
          $this-&gt;email-&gt;from('vaghasiamit@gmail.com','Elsner');
  
          $this-&gt;email-&gt;to('vaghasiamit@gmail.com');
  
          $this-&gt;email-&gt;subject('This is Test email');
  
          $this-&gt;email-&gt;message('hi');
  
  
          $this-&gt;email-&gt;send();
  
  
  
  
  
  
  
  
          if($this-&gt;email-&gt;send())
          {
              echo "email sent";
  
  
          }
          else
          {
  
              show_error($this-&gt;email-&gt;print_debugger());
          }
  
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>and Error  is:</p>
  
  <blockquote>
    <p>A PHP Error was encountered</p>
    
    <p>Severity: Warning</p>
    
    <p>Message: fsockopen(): php_network_getaddresses: getaddrinfo failed: No
    such host is known.</p>
    
    <p>Filename: libraries/Email.php</p>
    
    <p>Line Number: 2023</p>
    
    <p>Backtrace:</p>
    
    <p>File: C:\xampp\htdocs\Task2\application\controllers\email.php Line: 37
    Function: send</p>
    
    <p>File: C:\xampp\htdocs\Task2\index.php Line: 315 Function: require_once</p>
    
    <p>A PHP Error was encountered</p>
    
    <p>Severity: Warning</p>
    
    <p>Message: fsockopen(): unable to connect to ssl://smtp:gmail.com:465
    (php_network_getaddresses: getaddrinfo failed: No such host is known.
    )</p>
    
    <p>Filename: libraries/Email.php</p>
    
    <p>Line Number: 2023</p>
    
    <p>Backtrace:</p>
    
    <p>File: C:\xampp\htdocs\Task2\application\controllers\email.php Line: 37
    Function: send</p>
    
    <p>File: C:\xampp\htdocs\Task2\index.php Line: 315 Function: require_once</p>
  </blockquote>