0
votes

I am sending the repeatable content to the mandrill template which tied up with mailchimp through API using "weblee/mandrill" in laravel(php).

Content format sending to the API

$this->data['products'][]['title'] = "title1";
$this->data['products'][]['title'] = "title2";
$this->data['products'][]['title'] = "title3";
$this->data['products'][]['title'] = "title4";
$this->data['products'][]['title'] = "title5";
$this->data['name'] = 'John';
sendMandrilTemplate(template-name,'Subject','[email protected]',$this->data);



public static function sendMandrilTemplate($template_name,$subject,$to,$data){
        $mandril = new Mail(env('MANDRILL_SECRET'));
        $message = array(
                'subject' => $subject,
                'from_email' => config('mail.from')['address'],
                'to' => array(array('email' => $to)),
                'merge_vars' => array(array(
                    'rcpt' => $to,
                  )));
        $i = 0;
        foreach($data as $key => $value){
            $template_content[$i]['name']= $key;
            $template_content[$i]['content'] = $value;
            $i++;
        }
        $result = $mandril->messages()->sendTemplate($template_name,$template_content,$message);

        return $result;
    }

In mandrill template I am calling this data as following

    Hi <span mc:edit="name"></span>,    
    Products title list is as follows:
    <table>
      <tr><th> Product List </th></tr>
      <tr mc:repeatable="products">  
         <td><span mc:edit="title"></span></td>
      </tr>
    </table>

In email, I am not receiving the email content for repeatable products title, remaining is working fine including recipient name. Please guide, what I am missing in it.

1

1 Answers

0
votes

According to: Mandrill Zendesk

Other aspects of the MailChimp template language won't be recognized in Mandrill, so if you've created a template for use in MailChimp, it may need a bit of tweaking to allow editable regions to be replaced by Mandrill. For example, repeatable areas in MailChimp templates can't be repeated via Mandrill so you'd instead want to add multiple mc:edit regions for the number of items or sections you want to include.

which is pretty terrible tstl =(