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.

**The problem** - 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. 

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.

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 ?

Technology stack - PHP CI, MySQL, Apache, Windows

This is the email code that gets called on every new update - 

```
$config = Array(
        'protocol'  => 'smtp',
        'smtp_host' => 'smtp.gmail.com',
        'smtp_port' => 587,
        'smtp_user' => 'mailid@gmail.com',
        'smtp_pass' => 'password',
        'mailtype'  => 'html',
        'charset'   => 'utf-8',
        'smtp_crypto' => "tls"
        );

$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$this->email->set_mailtype("html");
$this->email->from('mailid@gmail.com', 'Support');
$this->email->to($this->session->userdata['email']);
$this->email->subject('You have posted a new update');
$this->email->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->email->send())
{
    show_error($this->email->print_debugger());
}
else
{
    echo true;
}

```