array in merge vars?

Oct 17, 2013 at 9:26 AM
Hi

I have the same problem as the guy in this post:

http://stackoverflow.com/questions/16605718/how-would-i-render-a-list-with-mandrill-template-out-of-array-passed-in-merge-va

I need to pass an array of items into a merge var and what to know how to handle it.

The data is a table of reports and different recipients will receive a different number of rows and different data. I don't want any HTML in my code. I am hoping that Mandrill can do it in the template.

Any ideas anyone?

thanks
Gus
Nov 20, 2013 at 9:20 PM
Update:

Mandrill templates are very limited and cannot handle arrays. So the only way to do it is to build the HTML tables in your code and send that
to Mandrill.

I ended up using a Razor template inside my application that created the email and then a single merge var in Mandrill. This made it very easy
as Razor is very powerful and easy to work with.

Its a shame Mandrill templates aren't view engine templates like Razor. As they are they are very limited and useful only for injecting either
ready formed HTML or pieces of text. If you want tabular reports then you need another way.

Gus