8 thoughts on “Sending Mandrill e-mails from Rails, the MVC way”

I have one question though: is it possible to pass rails parameter to the view?
My message contains dynamic content, for example I want to display the new arrivals of the store, the size of this variable sometimes is 3 others is 7. I have @items. and would like to do something like @items.each do |i| i.title end inside the message. Is it possible to do this? Thanks!

Thanks for this article Corey. Any benefit to merging on Mandrills side (via merge tags) versus doing it on your app’s side (via variables in the controller)? Just offloading the work to their servers?

Brian, the advantage to using Mandrill merge tags is being able to submit one API request for thousands of e-mails. If we merged on the app’s side, we’d have to use an API request for each individual e-mail, and would likely have to batch the requests and manage all of that.

(Even if you’re sending just one e-mail at a time, though, you might consider using Mandrill’s API and merge tags, as doing so would allow you to MailChimp and Mandrill templates, which you could update without redeploying your app. We might be heading this direction for receipts and such. See http://help.mandrill.com/entries/21694868-Getting-Started-with-Templates)