In a website, Some times sending an email take few seconds, so I need to send email from another thread, to don’t wait until the email sent.
I found this answer on stackoverflow, Is it fine to do it this way, incase I will send just one email per request?
Or there is another standard way to do this?
If possible, you should set up a local SMTP server that only listens on the loopback address (127.0.0.1) as this is exactly what mail queues are for. You can configure your SMTP server to relay through your real outbound mail server so that you don’t run into problems with SPF treating your mail as spam.
This way your application can quickly queue the outbound mail and be on it’s merry way and you can be reasonably sure that the message will eventually be delivered even in the event of heavy load, network issues, or even a crash.