How to send multiple emails after creating a node I'm using SMTP module to send e-mail messages after creating nodes. It takes about 3-4 seconds to send each such message using hook_node_insert. So if I want to send 10 messages, then I have to wait for 30-40 seconds for the iteration to complete and then only I get redirected to create new node. It's very slow.

I tried use event KernelEvents::TERMINATE per this article, but it did not speed up the whole process. 

Is there a way just to complete creating a node without waiting and immediately proceed to creating a new node, while sending e-mail messages at the same time?

Note: I don't want to create queue and wait for the next cron run to send e-mails. Because e-mails need to be sent instantly after creating respective node
As noted on the Reddit thread, this event will not work as described in this blog unless you are using PHP FPM. For most hosting providers this is the default setup. So, if you are using Apache with mod_php you are out of luck, it seems. 

Are you hosting with Apache and mod_php? You'll need Apache and use PHP FPM with some settings changed. Or use nginx.

Sounds like the problem is due to your server not streaming the output. Per the Symfony docs


  Internally, the HttpKernel makes use of the fastcgi_finish_request PHP function. This means that at the moment, only the PHP FPM server API is able to send a response to the client while the server's PHP process still performs some tasks. With all other server APIs, listeners to kernel.terminate are still executed, but the response is not sent to the client until they are all completed.


https://symfony.com/doc/current/components/http_kernel.html#the-kernel-terminate-event