I'm working on an application that will handle a lot of email sending, and I'm looking for a minimal email queue solution.
What the sending code will do, is get the "To", "From", "Subject", "Text", "Format" fields from the queue, generate the headers, and send the email. If the sent is not successful, it can be retried. I would like a priority system too, with, at least, two levels of priority.
I've been thinking and the ideas I got are these:
So I'm looking for ideas on how to do this email queue in an easy way. The system is done in PHP, and I'd like it to be in PHP, if there's solution.
Thanks in advance.
I've developed an email queue system for PHP that does exactly what you're asking for, check it our here. http://lorenzoherrera.github.io/emailqueue/
I've done something similar to this before to send about 200,000 emails in a day. Since they weren't time critical, I generated them (with Mail_Mime), and stored them all into a database, with Mail_Queue, sending them out with a shell script that kept re-running itself if the load average of the machine was OK.
Today, I'd do it with a Symfony-based system around Swiftmailer and White October SwiftMailer DB Bundle.
To have it avoid the database (which isn't optimum, but it does Just Work) I would use the DBBundle as a base and instead have it go through a queue system, such as Beanstalkd (it wouldn't be a big job to send it to a queue instead of a database table). The sending system can just delete the job if it decides it's 'too old'. Adding priorities to the queue job is also very easy - it's built right into Beanstalkd.
You could also elect to simply have the message in the queue be, "send user X an update email" - and the queue-runner goes to the original DB to assemble the email just before it is sent.