doudi4621 2015-08-10 14:59 采纳率: 0%
浏览 61
已采纳

使用php API和merge_vars填充mandrill模板

As we know, when using templates, we specify vars like this:

'global_merge_vars' => array(
      array(
          'name' => 'my first var',
          'content' => 'content i want to display'
      )
),

This is nice and all, but becomes a pain if I want to use handlebars to display lists of information (arrays) in my email. I have to create a function to parse the list of data to meet this name-content format criteria. Is there any way around that I'm missing? I'd really like to do something like this:

'global_merge_vars' => array(
      array(
          'name_of_var' => 'value',
          'some_array_name' => $myArray,
          'other_array' => $otherArray
      )
),
  • 写回答

1条回答 默认 最新

  • dtp0760 2015-08-10 15:09
    关注

    As the docs point out, that's the way the API is expecting that parameter.

    The send function from the Mandrill_Messages class has this in the docblock:

     *     - global_merge_vars array global merge variables to use for all recipients. You can override these per recipient.
     *         - global_merge_vars[] struct a single global merge variable
     *             - name string the global merge variable's name. Merge variable names are case-insensitive and may not start with _
     *             - content mixed the global merge variable's content
    

    Maybe write an email to Mandrill, although i doubt they'll consider any changes to their API.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 MapReduce结果输出到HBase,一直连接不上MySQL
  • ¥15 扩散模型sd.webui使用时报错“Nonetype”
  • ¥15 stm32流水灯+呼吸灯+外部中断按键
  • ¥15 将二维数组,按照假设的规定,如0/1/0 == "4",把对应列位置写成一个字符并打印输出该字符
  • ¥15 NX MCD仿真与博途通讯不了啥情况
  • ¥15 win11家庭中文版安装docker遇到Hyper-V启用失败解决办法整理
  • ¥15 gradio的web端页面格式不对的问题
  • ¥15 求大家看看Nonce如何配置
  • ¥15 Matlab怎么求解含参的二重积分?
  • ¥15 苹果手机突然连不上wifi了?