我的电子邮件模板有一些介绍性文本,后面是一个可重复的块,一个图片+一个按钮。
我想重复这个块一些X倍,每次都有图片链接和按钮链接更新与新的链接。
目前,我正在使用此有效负载来编辑一个块,并且它正在按预期工作。我使用了this SO answer作为指导方针。
var data = {
'template': {
'id': template_id,
'sections': {
'editbutton': '<a class="mcnButton " title="Get Profile" href="' + button1 + '" target="_blank" style="font-weight: bold;letter-spacing: normal;line-height: 100%;text-align: center;text-decoration: none;color: #FFFFFF;">GET DATA</a>',
'editimage': '<img alt="" src="' + image1 + '" width="564" style="max-width:564px; padding-bottom: 0; display: inline !important; vertical-align: bottom;" class="mcnImage">'
}
}
};我挣扎的是重复这个块和更新图像和按钮链接。
我在Google脚本中工作,但我想问题是语言的独立性。
任何帮助都将不胜感激。谢谢。
发布于 2018-12-09 18:20:57
我认为您根本不需要使用mc:repeatable或mc:variant。使用单个mc:edit="editbutton_and_editimage_items_list" MailChimp标记。将动态生成的HTML列表与实际数据放在一起,通过发送给<ul><li>的有效载荷的sections部分。
例如,上面的sections.editbutton_and_editimage_items_list对象中的var data = {..} JSON项如下所示:
<ul>
<li>
<a class="mcnButton " href="' + button1 + '" style="...">GET DATA</a></li>
<img alt="" src="' + image1 + '" width="564" style="..." class="mcnImage">
</li>
<!-- Repeat the LI with different data as needed --!>
</ul>在成功地使用上面的数据设置了尚未发送的活动的模板内容之后,请使用API发送该活动。
https://stackoverflow.com/questions/53692549
复制相似问题