Posted by playfulwolf on February 5, 2014 at 1:24pm
Hi there,
Building classified ads project which will use some heavy emailing: reminders, subscriptions, order confirmations and so on. Expect to be tens or hundreds thousand of emails per day. It may seem not huge quantity and standard Drupal email sending just works, but server and Drupal itself has more important tasks to do as sending batches of emails.
Which alternate and faster email sending modules would you recommend? Reliability and "set and forget" modules are also a priority.
Thank you!

Comments
Also interested in this...
I've had a brief look at MailGun while I was messing around in the RackSpace cloud. Looks pretty neat but I don't really know how to use it.
Another important consideration is making sure the mail "appears legit" so as not to get caught in spam filters etc.
This is pretty much the next item on my todo list so very interested to see what others have to say! :)
BC
Project is hosted on big VPS
Project is hosted on big VPS and will be moved to dedicated servers when in need for more resources and want to avoid any proprietary or 3rd party services.
From first look https://drupal.org/project/smtp is the candidate to try as it bypasses php mail function
drupal+me: jeweler portfolio
Very simple to use, and uses
Very simple to use, and uses dedicated mail servers, http://drupal.org/project/mandrill , can override all drupal mail via http://drupal.org/project/mailsystem
Much better than using your server to email and being blacklisted.
Thank you. Yes, Mailchimp
Thank you. Yes, Mailchimp have great services, but most or even all of the email sent through the site will be "lowest analytical value" - no need to collect links clicked stats and similar stuff. The need is to make everything dirt cheap or with no additional cost except server resources.
If it was commercial newsletter with the list of goods to buy or some kind of presentations - then yes, the more you know the better
drupal+me: jeweler portfolio
Amazon SES is another
Amazon SES is another alternative. It's pay as you go and you get 2,000 sends per day free. It uses an SMTP endpoint, so it works with the SMTP endpoint.
http://aws.amazon.com/ses/details/
HollyIT - Grab the Netbeans Drupal Development Tool at GitHub.
Note that I mentioned the
Note that I mentioned the Mandrill service by Mailchimp, not Mailchimp per se: this starts at 250 free emails/hours up to 12k emails/month.
And, as Jamie Holly mentioned, Amazon SES is a great alternative price-wise. Also, since it has now been available entirely via SMTP, you don't even need a specific module. That's actually how I send all my system monitoring emails for free.
Not for the poster
Since the original poster doesn't want 3rd party services, this isn't for him... but for others who come across this thread and are interested in such things.
We are using Mandrill for outbound and inbound (webhook) mail and it has been working pretty well. We get a much better understanding of 1) did the email get to the recipient's email provider, 2) was it opened, and 3) did they click on any link in the email.
This has helped a lot with debugging mail deliverability. We have seen that a lot of emails aren't opened. The email providers (particularly gmail) puts stuff in spam and "low priority" boxes, etc. We aren't sending spam ;) They have registered directly on the website in order to get the emails they are getting. So... we know that we need to work on some things in order to improve this problem.
It also lets us see if an email was rejected and then put the email address on a rejection whitelist and try sending the email again. And see bounces, etc.
Anyway... we are finding it very useful and recommend it to others who need that type of visibility / control.
Cheers!
Contact: https://www.hook42.com/contact
Drupal 7 Multilingual Sites: http://www.kristen.org/book
What is wrong in this group(s)?
People, I do not need 3rd party services which sells air. I need to send 10-200k emails per day from local Drupal server. Old school way. There 2 modules which crossed my mind:
https://drupal.org/project/smtp
https://drupal.org/project/phpmailer
95% of email will be simple txt with no links in there. The rest - some html.
So, which one does the trick better?
And, please, stop talking about "cloud" nonsenses.
drupal+me: jeweler portfolio
If you ask a question...
...expect informed answers. And then, maybe don't insult the people giving those answers, particularly if you're not very knowledgeable on the subject in question—which would seem to be the case, since A) you're asking for help, B) you refer to sending email the "old school way" as though that helps narrow down your options, and C) you call third-party services "nonsense." The solutions posted above are how many sites send bulk email these days. If you have a problem with these solutions, explain why in a constructive way so that we know how to help you better.
I would answer that, but your
I would answer that, but your insulting tone by considering options people have volunteered to give being "nonsense" just takes away my will to offer any advice.
HollyIT - Grab the Netbeans Drupal Development Tool at GitHub.
I wrote earlier, that would
I wrote earlier, that would like to stick to the server or Drupal module capabilities without the help of external 3rd party services.
Lets say, that "cloud nonsense" is my personal opinion which is based to my own experience and calculations. Please, do not discuss it further.
Yes, I admit I made a mistake by not writing in the first post - "no 3rd party services"
drupal+me: jeweler portfolio
To each his own... if you
To each his own... if you just want to go "old school", you do not even need a module: the drupal_mail() function passes control to php mail() function, which you can just plug to your own Sendmail instance to delivery mails as you see fit.
Of course, that assumes you are certain your server will never get blacklisted because of spam assumptions by overcautious destination domains. There may be cases where this assumption is justified. It just happens that this is a small minority: this is no longer the 80s, when open relays were the best current practice, the internet was vastly simpler because the web was not yet there, and I used to send mails like this. I've seen it change over the years, and switched to delivery services over time just to be realistic about the rest of the world.
Personal email server = doomed to failure
Out of interest, do you have anything set up to handle bounce messages properly, i.e. if an email server returns that either it thinks your message is spam, or that the recipient address doesn't exist, to have delivery properly handled? Without a system in place to handle these, and a bazillion other issues, these you are looking to have your server(s) blacklisted very quickly. As others have said, it is recommended today to use a proper email delivery service for bulk emails because they'll take care of the large number of problems that arise, and we're speaking from experience here, not just repeating something from Information Week.
All the emails - to the registered users
The idea of this project is to do some micro-monitoring to ads content, to be exact - to see price changes, new ads in some category and etc. Smth like auction portal but not that complicated.
All the emails will be sent to registered users and exactly to those which press button of "Notify about change in price", that means at least 9 of 10 will know what they are doing and they need that information. Something similar to groups.drupal.org. I am not talking about bulk messages. Newsletters are bulk messages, but not subscriptions to content monitoring.
My background includes 5+ years of running web hosting company at some time, and spam issues are known. They are pretty much controllable until you have customer who is is a spammer/scammer/does not update his phpbb/or is a plain idiot.
Another 3+ years of mine were of selling software solutions, one of them were based of Commtouch Zero-Hour Virus Outbreak Protection services - and that was around year 2005. Even then was the technology which filtered 99%+ of spam with 0.1% false positives. It was pricey back then though... Now similar technologies are in use on most major free email services and corporate emails. Lets say, that this is enough to understand a bit about email sending.
To deal with the problem such as recipient address doesn't exist or some bounce messages/errors - it is one of the easiest things to do. Any MTA manual has info about that.
Current situation is that I build a project which is 100% legit and will not generate spam itself
Sorry, do not know what Information Week is, i guess it is some kind of magazine.
drupal+me: jeweler portfolio
100,000 emails per day requires a real mail server
There are 86,000+ seconds in a day, and most emails take 2-3 seconds to send. Thus, only 43,000 emails can be sent from a mail server per day. Or less. Unless, you scale the hardware, or optimize. Drupal will not do what you are asking.
What you want is a mailing list server, and Drupal sends one email to the list server, which then sends your 10,000+ emails a day.
Drupal modules are definitely not the way to go... unless you need each email to be personalized. Then, scaling becomes a problem.
Hint: Use a module that spawns a child process, and avoids the "wait" of the email process returning with a code.
Peter
LA's Open Source User Group Advocate - Volunteer at DrupalCamp LA and SCALE
Thank you!
This is the first answer to the topic. I didn't knew the time it takes Drupal to send the email. Was expecting it to be in the 0.5s territory.
Yes, there will be substantial amount of emails which will be personalized.
Thank you! Seems I will need to think some kind of real world simulation tests.
drupal+me: jeweler portfolio
i've built a custom solution
i've built a custom solution that uses MimeMail and SMTP Authentication Support and works slightly along the lines of Mail Editor
It sends the messages over drupal batch (200 pieces / step) over a dedicated SMTP server, I end up @ ~4 messages per second, the bottleneck being currently in my lengthy and not yet optimized processes that prepare / log the messages.
I also do some bounce processing with a slight modification of a part of Mailhanler.
Even if it is 500 ms
Even if it is 500 ms, it adds up if you are trying to do too many of them per page load, or node submit, and becomes a problem.
We've written articles on this here
http://2bits.com/articles/how-reduce-page-load-times-sending-emails-cron...
http://2bits.com/articles/subscriptions-module-sending-notifications-as-...
The solution is to use a queuing mechanism rather than doing the send on the spot.
And that is why we wrote Queue Mail
https://drupal.org/project/queue_mail
Drupal performance tuning, development, customization and consulting: 2bits.com, Inc..
Personal blog: Baheyeldin.com.
You gave a solution to a big chunk of problem
Khalid, your answer is very valuable, but now I am messed up a bit: there seem to be many email sending related modules and functionality seem to overlap a lot.
The question: Queue Mail sends emails in the same way vanilla Drupal 7 does - with built in php function, but does it in batches during cron run? So, SMTP or PHPmailer modules add something to this what Queue Mail does not or they are not necessary? One of them seem to have a big user base.
drupal+me: jeweler portfolio
They server two different
They server two different functions.
Queue mail moves the email sending procedure to a queue rather than triggering it immediately. How that email gets sent still goes through drupal's mail system (and all its hooks). These other mail-related modules integrate with the mail system and its hooks to do their work.
--
Dave Hansen-Lange
Director of Technical Strategy, Advomatic.com
Pronouns: he/him/his
Queue Mail + PHPMailer or
Queue Mail + PHPMailer or Queue Mail + SMTP: All the features aside, which is to start testing with plain text emails?
drupal+me: jeweler portfolio
Drupal 7 has a queue mechanism built in
With Drupal 6, jobqueue was the contrib module to do the queuing. Drupal 7 has a queue mechanism built in, hence the difference.
The whole idea here is to stick to your initial requirement of not outsourcing the actual mail sending and list management to a third party, and doing it all in Drupal (which is not a good idea with 100s of thousands of emails per day).
To do this, we have have to delegate the sending to cron, so it is done in the background, in batches. This way, pages do not get delayed trying to send all this, and no pile ups occur. You use Elyisa cron and run cron every minute, with a set number of sends per minute.
I am not advocating that solution with your volume, just pointing you out to what is available. You are better off using something else to manage the emails somehow.
Drupal performance tuning, development, customization and consulting: 2bits.com, Inc..
Personal blog: Baheyeldin.com.
What takes those 2-3 seconds?
What takes those 2-3 seconds? Is that a slowdown with PHP or with the mail server? Would HTTPRL help with any of this?
Until this discussion I hadn't really thought about high performance mail servers. I always outsource large scale mailings to third-party services.
Don't know about HTTPRL
Don't know about HTTPRL but the keywords in PHPMailer and SMTP modules are 'bypassing mail() function' and 'keep-alive'. ATM looking for some HTTPRL presentations, found this screencast:
https://drupal.psu.edu/content/bench-marking-non-blocking-httprl-vs-drup...
Edit: MTA on modern 200$/month box is capable of sending many messages per second. If there is a simple way to speedup Drupal side - the game will change a lot.
drupal+me: jeweler portfolio
Get hacking
I've read the whole discussion above and I agree with others that sending email directly from Drupal page calls isn't sustainable.
To make this work you will need a custom module that leverages Drupal's Queue API. Each time you need to send an email add the required data to the queue. This data is likely to include, the name of the email template, the user object and if it relates to an item the item object. Have cron running every minute processing X items in the queue each run, so then you can send X messages per minute. You should consider running this on a separate node so it doesn't impact on web users during time of heavy load.
You will want to be running postfix (or another good SMTPd) on the same box that you're using for running cron. This will accept and queue the messages for delivery. You will need to ensure that you have SPF and DKIM setup properly along daily checking that your server or the network block hasn't been blacklisted.
Now for the silly cloud nonsense that you don't want to hear about - feel free stick your fingers in your ears and shout "LA LA LA! I'M NOT LISTENING! LA LA LA!", because others might find this information useful.
I would use a real Queuing system, such as RabbitMQ or depending on where the site is hosted AmazonSQS or Rackspace Cloud Queues. Like the scenario above you dump the data into the queue on an as needs basis. On the other end of the queue have a standalone application that is designed purely for preparing emails, which probably means using Python or Ruby. The email prep app which would run on a separate VM/box would then send the email out via a third party SMTP service such as Mailgun or Mandrill. These services stake their business on doing the best they can to get your messages delivered. This decoupled approach helps you distribute load and if you throw some HA services into the architecture should minimise downtime.
You can now take your fingers out of your ears.
Feel free stick your fingers
Feel free stick your fingers in your ears and shout "LA LA LA! I'M NOT LISTENING! LA LA LA!", because others might find this information useful.
We have got what we have got. The project I am working on will be hosted dedicated servers. I cannot change that or even somebody else responsible for the project can change that. This is not because it cannot run on Amazon or RS - it is because of price! All the business model would fail if the project is ran on Rackspace. From my (our) experience dedicated boxes with proper optimizations are 3 to 5x cheaper to run on the scenarios similar to I am working on. This is not a project for some cashcow client, it will fail big time if the micro-services of this project would need to be charged 0.5$ instead of 0.2$ because of the hosting cost.
I need numbers. The only thing which you or any other person talking about Mandrill or Mailgun can do - give me performance and price-to-performance comparison to dedicated box. Really had no clue how many emails typical Drupal box send. Now I got some numbers to start with: 43k per day, on lets assume box which costs 200$/month = ~7$/day, that is 0.16$ per 1000 emails sent. This is VERY comparable to Mandrill prices.
You can now take your fingers out of your ears.
The question of mine evolved into:
How can I make Drupal webserver to send not 43k emails per day but 143k?
drupal+me: jeweler portfolio
Sounds like you need a Drupal Bypass
Drupal is good for many things, but is not good for all things. Pay as you go cloud systems get costly due to software overhead.
I'm wondering what specific parts of drupal your application requires and how much of it you can shut down or bypass.
I'm not versed on the cron processing overhead, but when you start looking at throughput, ie pages per second, you have to consider how drupal operate and what you need it to do. The bootstrap operation loads each enabled module and all the system variables before considering your request. That can encompass accessing hundreds of files and a whole bunch of database calls. Opcache and other memory cache's store the files resident in memory, but still, each file is checked for being changed. In D7 that can range from less than 100 files to up around 400 depending on the number of modules. I've started to look at D8. D8's oop organization results in an even greater number of files, albeit small files. Thus, the more modules you enable the slower it gets.
Once your request is bootstrapped, the actual processing begins. If you are creating a node, countless hooks are called to see if any module needs to modify it before saving. Fortunately, the caching system saves each node as a render array to enable quick fetching as a serialized blob. The block system has to process and assemble the blocks, the menu system churns to load menu items and check translations of menu items. And the theme system has to spit it all out.
On quite modest hardware, a stripped down D7 can process pages in about 300mSec. On my D8 standard install I see 1-2 Sec with opcache (>5Sec without).
So it seems that if you really need a system that cranks, you have to look at the 'cost' of the software overhead in the application. Your email processor must be a lean mean fighting machine. I would suggest taking whichever opensource mail server you like, and modify it to pull data from the drupal database.
I'm currently looking for a good project, so let me know if you'd like assistance.
Bob Marcotte
Engineering Consultant
Marcotte Enterprises, Inc.
http://www.marcotteenterprises.com
I need the performance of node.js, simplicity of vanilla Drupal
Mainly I need the performance of node.js - like the miracles it does with chat applications mimicking push-mail and the simplicity of integrated Drupal mail sub-system.
Currently developing on BOA server, it has many many tricks on its sleeve, and some things which looked a bit slow on Apache now are pretty quick, so until the server costs can be contained by simple Drupal based solution it is ok.
But the idea of yours to use external mail agent and simply give to it access to database is worth second and third thought. Then it could be possible to send emails with 1/100th of resources. BINGO!
Was it done before? It should be!
Btw, I would like to hire you or smb else to work on similar piece of project and then contribute to community, but the projects I am working with are not in this level of size and funding. This one is probably the biggest, or at least the most complex.
drupal+me: jeweler portfolio
Here's what you aren't considering
Have you considered that there are very valid reasons why people bring up these services? It's not about simplicity or just "offloading the work". Setting up a server and a script (even Drupal) to send mass mails is actually rather simple. We all know that. You know who else knows that? Administrators of email servers. Others have already mentioned you have to deal with things like bounces, your IP being blacklisted (and I will tell you first hand, you can get a server and an IP, which hasn't been used in a couple of years, and there's a really good chance you'll have to fight with an email service to get that IP removed from the blacklist. AOL is a biggie here and a PITA to deal with).
What I haven't seen mentioned and something that is a huge problem as your number of sends increase, and why these cloud services are so popular is IP throttling. Most major email services only allow X number of emails from a single IP in a given time frame, including Gmail and Hotmail. That's one of their main ways to fight spam. These cloud services get around that by having multiple IP addresses. They also have worked with these providers to have their limits increased, something they won't do for just anyone and a reason why these service providers also have strict guidelines on what can be sent and how to deal with it.
Having said that, if you still want to go your own, then one of the best methods I have seen and done is to use a queuing service that Drupal can write the email to and then a separate script actually sends out the email. The system I did for a client last year was rather simple. Emails that needed sent were composed in Drupal. Drupal then sent that to a collection in MongoDB. I then had a simple NodeJS script running that monitored that MongoDB collection using tailable cursors (Mongo's version of PubSub), so that as soon as something got added, Node would send it.
Why this route? Simple - reliability. Mongo is persistent, so if the server crashed for whatever reason, things were still there. You could do it with MySQL though. Check a table for emails that aren't sent, send them, then check again. If nothing is there, then wait a few seconds and check again. This client already had Mongo, so I decided to go with that. As far as Node, it's very easy to thread using child process. So I can have up to X processes sending out emails at once. Each process only takes about 8mb of memory and only the master needs the Mongo connection. Sounds complicated, but I was able to achieve all this in only 2 days of coding.
Another reason - simple math. You can run Drupal's cron every minute. Drupal creates a lock so it only runs once job at a time. There are 1,440 minutes in a day. You say up to 200,000 emails per day, so let's take that since that is going to be your highend goal and we don't want an "oh crap, it broke" scenario. 200,000/1440 = 138 emails per cron job. Even if an email takes 1/2 a second to send, you are still out of time, and we aren't even considering any other Drupal tasks that will run on that cron. Meet your newly created bottleneck.
So the best route is to keep this part out of Drupal. You could try PHPMailer, which I have seen handle up to 100,000 emails per day. Of course that came with a pretty significant increase in server load to the point that it was scrapped (you don't want your emailing to start impacting the performance of your site). Even PHPList, tells you that the limit on a single server is about 3,000 emails per hour.
Finally, and possibly the most important issue. You said your one a big VPS and will go dedicated if you need to. Something about all eggs in one basket comes to mind here. Basically we've already determined, through some simple math, that a queuing service will be needed. There's another beauty of that. You don't need to have everything running on one server.
If it were me doing this, I would keep Drupal on that VPS and use smaller VPS' or clouds to handle the email part. Not only are you greatly reducing the impact sending all these emails will have on your site, but you're also creating something that is highly scalable. That's the beauty of what I did in Node. Instead of forking child processes, it can easily send out a batch of emails to a different server. And since everything is rather lightweight, those extra VPS' can be smaller. Your email list grows. Simple, increase the resources on that VPS or add another.
Oh and one other thing. Remember that big issue of sending mass emails from a single IP I mentioned at the beginning? Well you just got around that too.
(Quick note: You could do what I did in Node in PHP. It was quicker and easier for me to write it in Node though, mainly because there were npm packages that helped build this quickly, especially forking and being able to send messages to child processes through different messaging services.)
HollyIT - Grab the Netbeans Drupal Development Tool at GitHub.
Other side of scales...
You gave me lots of info to chew. From the first reading I can say: yes, most of the reasons people outsource to professional mail sending services are valid and so true, but 0.2$ per 1k emails is too much. That is the biggest issue. if it is 0.02$ then probably my initial post would not exist (batle-tested D7 module is a still a must). My use case is that 20 to 30 percent of the essence of project is "ad monitoring". 3rd party services charge for: email sending (base), reliability, subscribtion-unsubscription services, link tracking, analytics of all kind, data traffic, dealing with DNSBL - some of them are in grey territory themselves, email errors end so many things you never thought could exist. It is a must for important business newsletters, carefully prepared new event/product announcements, press releases, HTML heavy brochures etc. My case is that big part of the messages will be "Price of item XYZ has changed!" - they do not need anything extra except the base feature: email sending.
PRICE-PRICE-PRICE!
Please, do not make this post a flame of Drupal vs 3rd party email services. Now looking to speed-up what can be done locally. The less exotic and faster - the better.
drupal+me: jeweler portfolio
Email is most complex Internet Protocol
Of all the Internet Protocols (RFCs), email is the oldest, and most used, and has more features, than any other. More RFCs, more changes over the decades.
Trying to learn email methods on a Drupal Groups discussion ... it's not going to be fast. Learning email methods is never fun. It's hard, hard work.
The reason there are many custom solutions posted here is due to this complexity. No one solution fits all problems. With an expounding of your application, you have gotten closer. Can any list member now give you the fastest way to implement your requirements? Likely not, due to it's complexity.
A large degree of scaling experience is required. One dedicated server will not do all your services, except at the beginning, when volume is low. Getting the scaling experience is a very hard learning curve. It takes months. Of benchmarking various solutions, and configuration tweaks of those solutions.
There are not hard and fast answers for scaling custom email solutions with any CMS, or any other application. You will want to find a forum about email scaling. Hint: It's not here in GDO.
Expectations your initial production release will work, for several months, until it maxes the CPU or data bus of your host computer. At that time you will go into rush mode, trying to find a solution. You will first get a faster Host, more CPUs and faster bus. Just to get some breathing room for finding a long term solution. All the time wishing that email scaling was not as difficult as you learned in this discussion.
The CPUs going through 'context' changes is what slows down a dedicated host running too many daemons. So, your next solution will be to put the mail server on a second host connected via a private network connection. This scaling direction will continue, until you have several Drupal hosts and several email hosts. Scaling will then be achieved by throwing hardware at it, which minimizes the use of your time.
Eventually, you will want to replace all that with highly optimized computer OSes for each service, in order to reduce the number of racks, to just one, and save a lot of money.
That's the history I have seen over the last 20 years implemented by team after team. Good luck.
Peter
LA's Open Source User Group Advocate - Volunteer at DrupalCamp LA and SCALE
Why wait?
As a hardware guy, I've been laughing for 20 years at software guys throwing hardware at software problems.
Long live the banter!
:)
Bob Marcotte
Engineering Consultant
Marcotte Enterprises, Inc.
http://www.marcotteenterprises.com
Well, this group may be the
Well, this group may be the answer how to connect Drupal to mailing solution. Yes, you are right, I think term 'email' came even before 'internet' and has its own history, but would like to hear about things which are pretty narrow in my (our) case.
The task is dead simple - cheap, quick email sending out of website. Rack for sending email... It would be a huge success for the project, and then probably dedicated Certified Email Professional could be hired, but until then only earthy problems.
drupal+me: jeweler portfolio
Hi Audrius,have you find a
Hi Audrius,
have you found a pretty good solution finally?
Alexander
Amazon SES
I'd highly recommend Amazon SES - I used it with EE to send upwards of 7,000 e-mails a day to a very highly-spam-filtered e-mail service (Mailmarshal and Spamassassin, iirc).
http://aws.amazon.com/ses/
Performance Considerations with Amazon SES
I am about to deploy a site which will use Amazon SES for our newsletter.
I have everything up and running. However, performance is an issue. I assume you had the same issue and I wondered how you overcame it.
I'm considering using Mail Queue, together with Elysia Cron.
One off my mail lists is 10,000 people. My best guess is that the site will take hours to send all of the messages. So I may also use threads or perhaps set up a persistent http connection (If I can figure out how).
Any thoughts/suggestions/tips would be much appreciated.
Some sort of queueing system
Some sort of queueing system is essential. I have used message_subscribe and message_notify along with drush_queue , running drush queue-run message-subscribe on a cron task every couple of minutes. In my case the emails were highly personalised and took a lot of cycles to generate, as they had to gather data from 3rd party services to assemble the message. So I only processed a hundred or so on each cron run.
If the message generation is so expensive it's degrading the site performance, a possible fix is to spin up a dedicated machine to handle the cron tasks, ie a web server and maybe a DB slave that connect to your web site's DB but are not in your load balancer rotation.
If your emails aren't highly personalised, it's much easier and probably cheaper to use something like mailchimp to generate and send newsletters.
If the environment sending
If the environment sending the emails is running Postfix, then you already have a queue for sending the emails. If Postfix is configured as a relay, then it will queue messages until the next hop (SES in this case) has confirmed that it has received and is processing them.
I would recommend multiple queues for your emailing process if you need to generate a lot of information for the emails (one queue for each step), especially if that information comes from third party sources. Then have the final queue contain the completed message and send it as a normal email. Let Postfix act as a queue between you and SES in case there is a failure to contact SES on a request. Postfix will keep retrying.
mass_contact module did the trick
Thanks Brian (and Tripper) for the input.
I ended up using the Mass Contact module so that I people could email people based on their role (and their region using Taxonolgy). It allows email to be queued and then dispatched using cron. Weirdly it only dispatched one message on each cron invocation. I was able to make a small patch and have the cron job send all the pending.
Emails are now being send to Amazon SES at just over 3 a second. This probably good enough for now. If I need to improve the throughput I will probably make a second patch/tweak and have cron displatch the messages using a set of threads (https://www.exratione.com/2012/02/run-multiple-cron-tasks-in-parallel-in...).
Thanks again,
Clive
Sendy application
Not sure if it will help you, but I use the Sendy software on my Drupal LAMP server. It uses Amazon AES and works great. I don't know what is happening with Drupal integration, but is an excellent app once you get it up and running.
https://www.drupal.org/project/sendy
Queueing on AWS
As @tripper54 suggested, for this, you typically don't want to have Drupal do the sending, but use dedicated mailing software (if you have to use SES) or a campaign emailing service like mailchimp.
Assuming you want to do it on your own, since you are deploying on AWS, you may want to consider writing this as a Drush plugin (hence a CLI app, not web), and use the AWS SQS Queue API provider for D7, available in https://www.drupal.org/project/aws (direct SQS integration) and https://www.drupal.org/project/awssdk (lower level, but recommended).
If you want to send high
If you want to send high performance email,and you want it to make it through spam filters, you should use Mandrill. 5 minutes of set up and you're email services are high performance: https://www.drupal.org/project/mandrill
--
Portland Drupal Developer