The appearance of new threads from within the request handler is potentially dangerous: if you get a surge in traffic, you can create enough threads, which will worsen the spike.
It would be better to cancel sending mail to another process using a tool such as beanstalkd or another message queue, or use the -supplied mail system (my Linux mail(1) system mail(1) can insert an email message in 0.7 seconds, which corresponds to moderate mail loads )
Measure the amount of traffic expected. If this is an internal tool that will only be used by a few dozen people, then spawning of new streams is probably fine. If it was exposed to a big bad world, I would recommend a more reliable queuing mechanism that will have less impact on system resources.
source share