title: how to send email in CodeIgniter on live server
body: <p>In my codeIgniter project , i want to send email, i am using following mail function but its not working.please help me.
  Controller code follows: </p>
  
  <pre><code>public function mail() {
  $config = Array(
      'protocol' =&gt; 'smtp',
      'smtp_host' =&gt; 'ssl://smtp.googlemail.com',
      'smtp_port' =&gt; 465,
      'smtp_user' =&gt; 'xxx',
      'smtp_pass' =&gt; 'xxx',
      'mailtype'  =&gt; 'html', 
      'charset'   =&gt; 'iso-8859-1'
  );
  $this-&gt;load-&gt;library('email', $config);
      $toEmail = "suraj@paarva.in";
      $mailHeaders = "From: " . $_POST["userName"] . "&lt;br&gt; Email ID:". $_POST["userEmail"] ."\r\n";
      if(mail($toEmail, $_POST["Mobile"], $_POST["message"], $mailHeaders)) {
  
      print "&lt;p class='alert alert-success'&gt;Mail Sent.&lt;/p&gt;";
      } else {
      print "&lt;p class='alert alert-danger'&gt;Problem in Sending Mail.&lt;/p&gt;";
      }
  
      }
  </code></pre>