【问题标题】:Dynamically creating campaign using template id using mailsnake in django在 django 中使用 mailsnake 使用模板 id 动态创建活动
【发布时间】:2012-10-02 03:18:28
【问题描述】:

我使用 django 框架中的 mailsnake 从我的网站动态创建活动。想要将数据和图像直接添加到活动中,我将 html 数据添加到 postcard_heading00、postcard_image、std_content00 等部分。 编写如下代码:

mailsnake = MailSnake('apikey')

template_option = {'list_id':xxxx, 'subject':'testing', 'from_email':'xxxxx', 'from_name':'Test', 'to_name':'', 'template_id':54457, 'inline_css':True, 'generate_text': True, 'title':'testing' }

template_content = {"html_postcard_heading00":"<h1>Testing</h1>","html_std_content00":"<h1>Testing</h1>","html_postcard_image":"<img src='image_path'>"}

并将此内容传递给

campaignCreate(type='regular',options = template_option,content=template_content)

方法。 广告系列已正确创建,但内容仍未添加到广告系列中。

谁能告诉我为什么会这样?

【问题讨论】:

  • 数据将被添加到“std_preheader_content”、“std_preheader_links”、“std_social”和“std_footer”等部分。任何内容都将添加到上述部分中正确添加的图像或文本。问题与“postcard_heading00”、“std_content00”和“postcard_image”部分。可重复部分有什么问题吗?

标签: django mailchimp


【解决方案1】:

问题在于可重复部分。具有不同方式添加数据的可重复部分。 修改模板内容如下。

template_content = {'html_repeat_1:0:postcard_heading00':postcard_heading[0],
                    'html_repeat_1:0:postcard_image': postcard_img,
                    'html_repeat_1:0:std_content00': std_content[0]}

我这样做了,问题就解决了。

【讨论】:

    猜你喜欢
    • 2020-09-16
    • 2015-01-22
    • 2011-04-12
    • 1970-01-01
    • 2013-04-02
    • 1970-01-01
    • 1970-01-01
    • 2013-03-22
    • 1970-01-01
    相关资源
    最近更新 更多