title: Delay due to email send PHP CodeIgniter
body: <p>First of all, I would like to thank StackOVerflow and its users for helping me solve a number of technical problems. I created this account today since I could not see similar problem being addressed.</p>
  
  <p><strong>The problem</strong> - I am stuck with a problem with sending emails in PHP CodeIgniter. The function $this->email->send() is taking around 3-4 seconds each time to execute. </p>
  
  <p>We have a social platform where users come and post things. Every time the user uploads a new update we want to send an email to him/her.
  The problem is the send email function takes around 3-4 seconds and we would love to bring it down under 1 second.</p>
  
  <p>IS there any way wherein we can execute the send email process in parallel ? Say a python code which runs continuously to fetch new updates and send emails to those users. Any better method than that ?</p>
  
  <p>Technology stack - PHP CI, MySQL, Apache, Windows</p>
  
  <p>This is the email code that gets called on every new update - </p>
  
  <pre><code>$config = Array(
          'protocol'  =&gt; 'smtp',
          'smtp_host' =&gt; 'smtp.gmail.com',
          'smtp_port' =&gt; 587,
          'smtp_user' =&gt; 'mailid@gmail.com',
          'smtp_pass' =&gt; 'password',
          'mailtype'  =&gt; 'html',
          'charset'   =&gt; 'utf-8',
          'smtp_crypto' =&gt; "tls"
          );
  
  $this-&gt;load-&gt;library('email', $config);
  $this-&gt;email-&gt;set_newline("\r\n");
  $this-&gt;email-&gt;set_mailtype("html");
  $this-&gt;email-&gt;from('mailid@gmail.com', 'Support');
  $this-&gt;email-&gt;to($this-&gt;session-&gt;userdata['email']);
  $this-&gt;email-&gt;subject('You have posted a new update');
  $this-&gt;email-&gt;message('Please login to check your new update. Do not reply to this email. For any issues reach out to email@emailid.com');
  
  if (!$this-&gt;email-&gt;send())
  {
      show_error($this-&gt;email-&gt;print_debugger());
  }
  else
  {
      echo true;
  }
  </code></pre>