mc:edit fields not populating via the API

726 views
Skip to first unread message

Spencer

unread,
Jul 10, 2012, 7:48:32 PM7/10/12
to mandrill-a...@googlegroups.com
Hey all, I'm having a great time integrating Mandrill into our web app, but am having troubles getting the mc:edit fields to populate.  What happens when I execute my code is that I receive my templatized email, but all the placeholders for my mc:edit fields remain and my "template_content" isn't used.  Everything else works as expected (to, from, subject, etc).  Any help would be greatly appreciated!  I expect that I have just done something silly, but a fresh pair of eyes would really help :-). 

Here is a snippet from the template (imported from MailChimp): 

<h1>Dear <strong mc:edit="name">John Doe</strong>,</h1>
<p mc:edit="message">Nulla vitae elit libero, a pharetra augue. Vestibulum id ligula porta felis euismod semper.</p>

And here is my request (made via Rails with the mandrill gem - sorry for the ruby-style json hash!):

{:message=>{:html=>"", :text=>"", :subject=>"News: We now have transactional emails!", :from_email=>"ques...@mydomain.com", :from_name=>"MyDomain", :to=>[{:name=>"Spencer", :email=>"spe...@emailme.com"}], :headers=>{}, :track_opens=>true, :track_clips=>true, :auto_text=>true, :url_strip_qs=>true, :bcc_address=>""}, :template_name=>"Standard Message", :template_content=>[{:name=>"message", :content=>"Curabitur blandit tempus porttitor."}, {:name=>"name", :content=>"Spencer"}]}

Kaitlin

unread,
Jul 10, 2012, 10:28:24 PM7/10/12
to mandrill-a...@googlegroups.com
You can double check the API call that Mandrill actually received in the account to verify that everything matches with the expected format. Click on the gear icon at the upper right and then "API Logs" to view the last 100 successful and 100 failed calls and the response. It's a good way to see what Mandrill got and compare to the example request for the API call that you're making. Also, double check that there aren't multiple mc:edits with the same name.  In general, you probably don't want an mc:edit in a "strong" tag.  They're usually best used in div tags or table tags rather than formatting tags.  For names, though, we recommend using merge tags.  You can read more details about using merge tags in the Mandrill KB:

http://help.mandrill.com/customer/portal/articles/539322-using-merge-tags-to-add-dynamic-content

If you check the API logs and the template and things still aren't lining up as expected, send us an email with your account information so we can look at the specifics - help.mandrill.com




On Tuesday, July 10, 2012 7:48:32 PM UTC-4, Spencer wrote:
Hey all, I'm having a great time integrating Mandrill into our web app, but am having troubles getting the mc:edit fields to populate.  What happens when I execute my code is that I receive my templatized email, but all the placeholders for my mc:edit fields remain and my "template_content" isn't used.  Everything else works as expected (to, from, subject, etc).  Any help would be greatly appreciated!  I expect that I have just done something silly, but a fresh pair of eyes would really help :-). 

Here is a snippet from the template (imported from MailChimp): 

<h1>Dear <strong mc:edit="name">John Doe</strong>,</h1>
<p mc:edit="message">Nulla vitae elit libero, a pharetra augue. Vestibulum id ligula porta felis euismod semper.</p>

And here is my request (made via Rails with the mandrill gem - sorry for the ruby-style json hash!):

{:message=>{:html=>"", :text=>"", :subject=>"News: We now have transactional emails!", :from_email=>"questions@mydomain.com", :from_name=>"MyDomain", :to=>[{:name=>"Spencer", :email=>"spe...@emailme.com"}], :headers=>{}, :track_opens=>true, :track_clips=>true, :auto_text=>true, :url_strip_qs=>true, :bcc_address=>""}, :template_name=>"Standard Message", :template_content=>[{:name=>"message", :content=>"Curabitur blandit tempus porttitor."}, {:name=>"name", :content=>"Spencer"}]}

Spencer

unread,
Jul 12, 2012, 1:00:25 PM7/12/12
to mandrill-a...@googlegroups.com
Hi Kaitlin, thanks for the quick response and for pointing out the API Logs - those are quite useful.  At a quick glance, the API calls look good and match what I am sending. I'll double check the template and take up your suggestions about the merge tags for the smaller chunks of dynamic content.  If I still can't get it working I'll send you guys an email.

I'll update this thread if I figure it out so others can benefit.

Thanks for the help.
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages