Does the Mandrill dynamic template support collection iteration?

I would like to add dynamic content to my email, part of which is a collection of items (like a list of books). I would like Mandrill to display each of these items once (for example, one table per book). Is there any way to use for-loop in Mandrill?

+3


source to share


2 answers


Yes! Mandrill now offers full support for dynamic list iteration when you use the Handlebars templating language .

Here's how to do it:



+5


source


Note. This answer is outdated, this feature was added shortly after I wrote this post.

This is not possible (see the note at the end of this page ). Their recommended solution is to use multiple mc: edit sections or variables (one per item) in the Mandrill template.



Since this cannot be done for unknown collection sizes, I decided to preprocess multiple parts of the email (e.g. header, body, footer) using a more powerful templating language (mustache in my case). I am only submitting these preprocessed parts to Mandrill via the API.

+2


source







All Articles