renz45 / mandrill_mailer

A small gem for sending Mandrill template emails
260 stars 84 forks source link

Amazon SES #124

Closed pbstriker38 closed 7 years ago

pbstriker38 commented 7 years ago

Is it possible to use Amazon SES as the sender of emails and just grab templates from Mandrill?

Amazon ses is set up in my production.rb like so:

config.action_mailer.delivery_method = :aws_sdk

renz45 commented 7 years ago

Sadly this is just a wrapper for the mandrill API gem that makes it work like other Rails mailers. It's still using the Mandrill API for template emails. I'm not sure how fetching templates would work since variables are sent in to be inserted into the template before it's sent.

pbstriker38 commented 7 years ago

ok. I guess I'll just have to do something like this:

mandrill = Mandrill::API.new(ENV.fetch('MANDRILL_API_KEY'))

mail(to: 'email@service.com', subject: 'subject') do |format|
  format.text { strip_tags(mandrill.templates.render('simple_test', [], [{name: 'FIRST_NAME', content: 'Daniel'}])["html"]) }
  format.html { mandrill.templates.render('simple_test', [], [{name: 'FIRST_NAME', content: 'Daniel'}])["html"] }
end
renz45 commented 7 years ago

Sounds good :) Going to close this, feel free to reopen if there is anything else.