Syed Humza Shah


Engineering leader. Likes coffee. Loves to travel. Runs on a combination of optimism and pragmatism.

Read more about him here.

MailRotator gem combines multiple email-sending services

Email deliverability and throughput are some of the main reasons why you’ll see many Rails projects involving services like SendGrid.

The problem with such services however is that they allow only a few hundred emails for free. From then onwards, you need to pay.

You could compare services and pick the one that lets you send the most free emails; however there is another way to increase your free emails’ limit:

My MailRotator gem. It’s very easy to configure. You can add as many mail-sending services as you want, along with a limit for each one. It’ll keep track of the emails sent and it will start off with the last service, even after deployment/restart/whatever.

By using the gem, I’ve upped my limit of 1200 free emails per month (through Mandrill) to 1600 (by adding SendGrid’s 400 free emails).

Needless to say, such an approach would be best suited to personal Rails projects. Because in client projects, you would want to be able to analyze all the sent emails through a single app, rather than having multiple apps and figuring out a way to manually analyze the reports in a broader sense.