I'm trying to send out transactional emails using Mandrill on Rails 3.2.8 (using this gem:
https://github.com/tatemae-consultancy/mandrill).
Here is the code to send the mailer:
def mail_out
m = Mandrill::API.new(ENV['MANDRILL_PASSWORD'])
content = [ { "name": "blah", "content": "blahblah"} ]
m.messages 'send-template', {
:key => ENV['MANDRILL_PASSWORD],
:template_name => 'Name of template under outbound -> templates'
:template_content = content
:message => {
:subject => 'Subject of email',
:from_name => 'name',
:to => mailing_list
},
:track_opens => true,
:track_clicks => true
}
end
I call a rake task to send this:
task :mail => :environment do
MyClass.mail_out
end
I get this error:
(-2) Validation error: {"template-content": "please enter an array", "message": "please enter an array"}
When I dump out the message to send in the console, I can correctly see that "template_content" and "message" are passing an array of hashes. Any ideas as to why this is happening?