Question

I have a site with user registration hosted on Heroku so I already have the Mandrill Add-On which is connected to my Mailchimp account. Right now, when a user signs up it sends them an email using ActionMailer and just a text.erb file with some words but I'd prefer to use one of my Mailchimp email templates with Mandrill. I haven't found any good places on the web that talk about how to do this and something tells me y'all know exactly how to do this.

As mentioned, I already have the code set up on the app to send the email, just not the template from Mailchimp using Mandrill.

As always, any help is truly appreciated.

Was it helpful?

Solution

I would strongly suggest you using the Mandrill Mailer gem. It will definitely help you with what you are trying to accomplish. Here is what you want to do with your Signup Mail (mainly copied from the gem github docs):

class SignupMailer < MandrillMailer::TemplateMailer
  default from: 'support@example.com'

  def signup(signup)
    mandrill_mail template: 'Signup Template', # Whatever name you have in Mandril
                  subject: 'Thanks for signing up!',
                  to: {email: signup.email, name: signup.name},
                  ....
  end
end

Basically you want your Mailer to inherit from the MandrillMailer::TemplateMailer, and then tell it which template you want to use from your Mandril account.

Check the docs on the gem site, but it's pretty straight forward ~

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top