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