首页 文章

Mailchimp可重复使用Mandrill无法正常工作

提问于
浏览
0

我将可重复的内容发送到mandrill模板,该模板使用laravel(php)中的“weblee / mandrill”通过API绑定mailchimp .

发送到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','abc@gmail.com',$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;
    }

在mandrill模板中,我将此数据称为以下内容

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>

在电子邮件中,我没有收到可重复产品 Headers 的电子邮件内容,剩余工作正常,包括收件人姓名 . 请指导,我在其中缺少什么 .

1 回答

  • 0

    根据:Mandrill Zendesk

    MailChimp模板语言的其他方面赢得了't be recognized in Mandrill, so if you' ve创建了一个用于MailChimp的模板,可能需要进行一些调整以允许可编辑区域被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.

    这是非常可怕的tstl =(

相关问题