Skip to main content

Migrate away from Mandrill?

Gems / Libraries • Asked by Michael Stitt

You have a screencast where you describe how to incorporate Mandrill into your Rails application, and because of that I've used it in the last couple of apps I've built. I'm assuming you saw the blog post yesterday where the CEO of Mailchimp announced that you'll need to have a paid Mailchimp account in order to continue using Mandrill.

I only have one app in production which sends an invitation and password reset emails for an internal-only Rails app (serving ~20 users right now). I plan on pushing another application to production within the next month but that will likely not do more than 1,000 emails a month for the first couple months. I really liked that Mandrill offered a free tier to experiment and prototype with, so I guess I'm looking for another option similar to their previous offering.

I'm happy to pay for a transaction email service once I start consistently sending out thousands of emails but I'd rather not have to pay upfront for a service I'm most likely not going to use quite often. So, I'm writing to see if you plan to use a different service for transaction emails in future applications or if you have any other recommendations on Mandrill alternatives. Thanks!


Kind of unfortunate as a lot of apps I run are in the same predicament.

One of my good friends works at MailJet and was telling me about all the things they're doing and they offer a free 6000 emails a month. https://www.mailjet.com/pricing_v3 They're like both Mailchimp and Mandrill combined, not just transactional email which is super nice in case you want to do marketing stuff as well. I think I'm going to be trying them out personally. They've been mostly focused on Europe in the past so most people haven't heard of them as much.

Of course there are all the other options: Sendgrid, Postmark, etc. I don't think you can really go wrong with any of them. I like Postmark a lot and Sendgrid is a powerhouse for transactional email that everyone knows.


Thanks, I'll checkout MailJet. I'm kind of leaning towards SendGrid since they offer a Free Tier (12k emails per month).

It looks like I'm not the only one scrambling to find an alternative: HN discussion


I like PostMark a lot.


For those coming to this thread in the future, I decided to migrate to SparkPost. They have a great Mandrill Migration Guide, plus they offer 100,000 free emails per month!

I used Chris' screencast to setup Mandrill initially, so switching to SparkPost was easy as all I had to do was change a few of the parameters within the config/initializers/mail.rb file.


FYI I've been using SparkPost for a couple months now with no troubles. However, a couple weeks ago they suspended my account without notifying me. A user complained that the forgot password link was not working, I did some debugging and the code didn't change. I logged into their UI and found a very hard-to-notice flash message stating,

Your account has been suspended from sending. Please email [email protected] for help with your account

Mind you, all I do is send invitation and forgot password emails with this application. So, I emailed the Abuse department and got the following automated response:

Hello,

Thank you for your interest in SparkPost. We strive to offer the very best email service, and to that end, we maintain a strict anti-abuse messaging policy. The content of your messages is against our policies. To get good deliverability, messages must make their way through spam filters unscathed. Unfortunately, there is a high degree of abuse in your industry that makes it very difficult to deliver legitimate messages with similar content.

Because we cannot offer you the high deliverability you would expect from SparkPost, we must decline to provide our services. We wish you the best in your future business endeavors.

Respectfully,

The SparkPost Deliverability & Compliance Team

I responded to the email letting them know I think their algorithms are making a mistake. After getting no response I reached out to Customer Support and they said they'd look into. A couple days later I get the same automated response from the Abuse team.

After a couple different emails with Customer Support they eventually reactivated my account. With the exception of this event I've been happy with their service. Hopefully they'll fix these mistakes from happening.


Wow, sounds like terrible support from them, hopefully they improve with that. I hadn't heard of them actually. I'm using Mailjet right now, but their UI needs some work. Possibly going back to Sendgrid myself, but we'll see.


We've been using PostMark for the past 3-4 months. They give you 25k emails free and another 10k if you send your first transactional email via the API 24 hours post signing up.

We've loved their support as well!


Hi Chris, please can you do a video showing how to setup transactional email in one of these. I've tried Campaign Monitor, Postmark and Sendgrid but I can't find instructions that show how to install it to work in rails. I'm stuck with campaign monitor (the gem 'createsend' talks a lot about omniauth authentication - -I don't know why that's relevant to sending a devise confirmation email. The postmark gem instructions tell me to initialise something, but don't show how to do it. I'm not learning very well - I can't follow the conceptual instructions for these gems because I just can't figure out what they mean. Please can you show how to setup one of these alternatives to Mandrill. Thank you


Hey Mel! For the most part, they're going to be the same. You'll just setup your Rails server to connect to their SMTP server. Sendgrid has instructions on this here: https://sendgrid.com/docs/Integrate/Frameworks/rubyonrails.html

It's the same way you would connect to Mandrill, Mailjet, Sparkpost, etc over SMTP, just using different credentials and a different server address. I'll try to do a screencast on this sometime soon!


Hi Chris. Thanks for the reply. I'm really struggling. I've been combing through the Sendgrid documentation since your note (all night last night). I can't make sense of it. The getting started guide linked in the documents on the sendgrid-rails gem is broken. The getting started guide on the sendgrid site refers to a ruby gem. The documentation for that gem is incomprehensible. I found a sendgrid add-on for heroku but I can't seem to get any functionality out of that either (whilst it gives code examples - it doesnt identify where those bits of code need to be placed).

I can make a template in sendgrid for devise confirmation email but I can't figure out how to give that template the confirmation token from the rails app.

Also, I can't make sense of conflicting documentation: if I make an initialiser called mail.rb (which I have - following the instructions on the sendgrid website) - I set the domain as my domain name (my_app.com). When I look at the heroku add on sendgrid instructions, it says to set the domain as heroku.com. I don't know whether or how to reconcile them. There are a lot of stack overflow posts describing instructions to set up "config.action_mailer.default_url_options = { host: config.app_domain }, config.action_mailer.smtp_settings = {..." in production.rb - but do I need this if I make a mail.rb initializer file?

I can't seem to find instructions that work for people who just aren't clever enough to make sense of the documentation. I've been struggling for years to grasp the basics- I think coding might be beyond me. I am also very confused by all of the options that Sendgrid needs in order to get an API key from its website. It's also confusing for me -I've now tried to setup campaign monitor/createsend gem; postmark; mailjet without any success - the documents for each of them talk about things I can't figure out- but in each of those other cases (as well as mandrill) I had to add a TXT record to my DNS to be able to send mails. The sendgrid documentation doesnt ask me to do that. Is there a reason for that?

Please, please can you do a tutorial showing how to setup a mailer (any one other than mandrill) so that I can get it working with devise.

Thank you.


Hi Chris,

I've had another 24 go at trying to figure out how to get started with Sendgrid. These are my current challenges:

Issue Summary

I'm struggling to understand the documentation for how to get started using WebAPI v3.

The authentication section of the getting started section says " To use keys, you must set a plain text header named “Authorization” with the contents of the header being “Bearer XXX” where XXX is your API Secret Key." https://sendgrid.com/docs/API_Reference/Web_API_v3/How_To_Use_The_Web_API_v3/authentication.html

Q1: Where & how do I set this text header? Is this a reference to making a TXT record in my DNS?

The transactional templates overview says "Including the template ID in the templates parameter of the Web API v3 Mail Send endpoint" This page has a link to Ruby libraries, which in turn links to this gem.

Q2: Where and how do I include a template ID in the endpoint?

The sendgrid-ruby gem documentation has an example for various ways to use the gem. The examples for General v3 Web API Usage distinguish between cases where fluent influence is or is not used. I can't find anything to tell me what fluent influence is or does.

Q3: What is fluent influence? How do I determine whether or not I should be using it?

If I do pick a General v3 Web API Usage option,

where in my app do I write these lines?

require 'sendgrid-ruby'
sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
response = sg.client._("suppression/bounces").get()
puts response.status_code
puts response.body
puts response.headers

Once I've figured out how and where to write the above lines, how do I ask my app to send a template email that I have made in Sendgrid's transactional templates section?

Technical details:

gem 'sendgrid-ruby'
gem 'sendgrid-rails', '~> 2.0'
gem 'mail'
ruby "2.3.0"

Do you know of any resources or tutorials that might help to solve these problems?


Hey Mel, I've got a project that I need to add Sendgrid to today, so I'm going to make a video on it for you. :)

I think one thing you ran into was that there are a couple ways to talk to Sendgrid. One is the SMTP connection which was what I linked (and the one you'll actually want to use) but then there's the sendgrid API which is not what you want to use, but that's where the gems come from. Two separate things that are never clearly explained the differences about.

I'll be doing a video on SMTP and I'll go into depth to explain how that all works for ya.


Hey Mel! Just recorded this and wanted to share it with ya so you could watch it before I officially publish it. https://excid3.wistia.com/medias/9bst8e6py7

Let me know if this helps! I tried to explain all the aspects of SMTP and stuff to hopefully give a deeper explanation of all the things going on for it, so hopefully it makes things easier to understand!


I am so grateful for this recording. THANK YOU! And so fast.


Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 27,623+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.