Validation error - {"template-content": "please enter an array", "message": "please enter an array"}

1,581 views
Skip to first unread message

David

unread,
Sep 12, 2012, 2:42:13 PM9/12/12
to mandrill-a...@googlegroups.com
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"} ]
  mailing_list = [ {'email': 'em...@mail.com'}, {'email': 'em...@mail.com'}, {'email': 'em...@mail.com'} ]

  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_email => 'mye...@email.com',
      :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?

Kaitlin

unread,
Sep 20, 2012, 1:25:23 PM9/20/12
to mandrill-a...@googlegroups.com
Hi David,

Sorry for the delay in a response here.  I think we got you taken care of via email, but I thought I'd respond in case others are having the same issue.

The error message seems to be being generated by the specific API client being used, and not the Mandrill API.  There's an outstanding pull request that seems to address this issue:

https://github.com/tatemae-consultancy/mandrill/pull/3

--Kaitlin
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages