by bar-b-q · 10y ago · 0 comments
You could add your emails to a db table and have a cron job consume them.
But for sending an occasional email? I've never really had a problem with just connecting to the SMTP server in the request/response cycle. If it takes more than a second to send then something is seriously wrong. You could use Mailgun or similar services which have their own queue for handling bulk sends and further reduce the likelihood of a problematic blocking of the web-server.
Maybe I will try something simpler like http://stackoverflow.com/a/4447147
If you are on AWS, you could just use something like their email service to fire off the request, then you don't need a queue at all.