title: SMTP Mail not sending - Codeigniter Email Library
body: <p>I'm having issues in sending mail through SMTP Protocol. </p>
  
  <p><strong>Welcome.php</strong></p>
  
  <pre><code>$this-&gt;load-&gt;library('email');
  
  $config = array();
  $config['protocol'] = 'smtp';
  $config['smtp_host'] = 'smtp.zoho.com';
  $config['smtp_user'] = 'support@domain.com';
  $config['smtp_pass'] = '**************';
  $config['smtp_port'] = 465;
  $config["smtp_crypto"] = "ssl";
  
  $this-&gt;email-&gt;initialize($config);
  
  $this-&gt;email-&gt;set_newline("\r\n");
  $this-&gt;email-&gt;from('support@domain.com', 'Support name'); // change it to yours
  $this-&gt;email-&gt;to($to);// change it to yours
  $this-&gt;email-&gt;subject($subject);
  $this-&gt;email-&gt;message($message);
  
      if($this-&gt;email-&gt;send())
      {
        echo "Success! - An email has been sent to ".$to;
      }
      else
      { 
        show_error($this-&gt;email-&gt;print_debugger());
        return false;
      }
  }
  </code></pre>
  
  <p><strong>Here is the output error:</strong></p>
  
  <pre><code>An Error Was Encountered
  220 mx.zohomail.com SMTP Server ready June 29, 2018 5:16:40 AM PDT 
  
  hello: 
  
  The following SMTP error was encountered: 
  Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.
  Date: Fri, 29 Jun 2018 12:16:40 +0000
  From: "Support Name" &lt;support@domain.com&gt;
  Return-Path: &lt;support@domain.com&gt;
  To: recipent@gmail.com
  Subject: =?ISO-8859-1?Q?=43=6F=70=79=20=61=6C=6C=20=74=68=65?=
  Reply-To: &lt;support@domain.com&gt;
  User-Agent: CodeIgniter
  X-Sender: support@domain.com
  X-Mailer: CodeIgniter
  X-Priority: 3 (Normal)
  Message-ID: &lt;5b36232840595@domain.com&gt;
  Mime-Version: 1.0
  
  
  Content-Type: multipart/alternative; boundary="B_ALT_5b3623284061c"
  
  This is a multi-part message in MIME format.
  Your email application may not support this format.
  
  --B_ALT_5b3623284061c
  Content-Type: text/plain; charset=ISO-8859-1
  Content-Transfer-Encoding: 8bit
  
  Some
  
  
  --B_ALT_5b3623284061c
  Content-Type: text/html; charset=ISO-8859-1
  Content-Transfer-Encoding: quoted-printable
  
  Some Email Description=0A=0A Some Email Description
  
  --B_ALT_5b3623284061c--
  </code></pre>
  
  <blockquote>
    <p>Note: The script is working fine on localhost, as well as multiple
    other hostings but not working on VPS Hosting.</p>
  </blockquote>
  
  <p>These are the things to remember:</p>
  
  <ol>
  <li>The code is fine (Tried in different hosting and it works)</li>
  <li>Changing <code>$config['protocol'] = "smtp";</code> to <code>$config['protocol'] = "sendmail";</code> it works. But i want to send mail only through SMTP Protocol. </li>
  <li>Using Zoho Mail SMTP Protocols (smtp.zoho.com)</li>
  <li>Tried, Google SMTP, Still not sending. (Used PHPMailer Library to test with the credentials. It's working on them.)</li>
  </ol>