当前位置: 首页>>代码示例>>Python>>正文


Python MailSnake.campaignCreate方法代码示例

本文整理汇总了Python中mailsnake.MailSnake.campaignCreate方法的典型用法代码示例。如果您正苦于以下问题:Python MailSnake.campaignCreate方法的具体用法?Python MailSnake.campaignCreate怎么用?Python MailSnake.campaignCreate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mailsnake.MailSnake的用法示例。


在下文中一共展示了MailSnake.campaignCreate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: create_campaign

# 需要导入模块: from mailsnake import MailSnake [as 别名]
# 或者: from mailsnake.MailSnake import campaignCreate [as 别名]
def create_campaign(html, text):
    mc = MailSnake(settings.MC_API_KEY)
    options = {
        "subject": datetime.today().strftime(settings.SUBJECT_TEMPLATE),
        "from_email": settings.MC_EMAIL,
        "from_name": settings.MC_FROM_NAME,
        "to_name": settings.MC_TO_NAME,
        "template_id": find_template(settings.MC_TEMPLATE_NAME),
        "list_id": find_list(settings.MC_LIST_NAME),
    }
    section_name = "html_" + settings.MC_TEMPLATE_SECTION
    content = {section_name: html, "text": text}
    cid = mc.campaignCreate(type="regular", content=content, options=options)

    return cid
开发者ID:kylehg,项目名称:pericles,代码行数:17,代码来源:pericles.py

示例2: create_campaign

# 需要导入模块: from mailsnake import MailSnake [as 别名]
# 或者: from mailsnake.MailSnake import campaignCreate [as 别名]
def create_campaign(html, text):
    mc = MailSnake(settings.MC_API_KEY)
    options = {
        'subject' : datetime.today().strftime(settings.SUBJECT_TEMPLATE),
        'from_email' : settings.MC_EMAIL,
        'from_name' : settings.MC_FROM_NAME,
        'to_name' : settings.MC_TO_NAME,
        'template_id' : find_template(settings.MC_TEMPLATE_NAME),
        'list_id' : find_list(settings.MC_LIST_NAME)
    }
    section_name = 'html_' + settings.MC_TEMPLATE_SECTION
    content = {section_name: html, "text": text}
    cid = mc.campaignCreate(type='regular', content=content, options=options)

    return cid
开发者ID:adicu,项目名称:pericles,代码行数:17,代码来源:pericles.py

示例3: MailSnake

# 需要导入模块: from mailsnake import MailSnake [as 别名]
# 或者: from mailsnake.MailSnake import campaignCreate [as 别名]
    results = parser.parse_args()
except IOError, msg:
    parser.error(str(msg))

markdown = results.m

moptions = {}
moptions['list_id'] = results.l
moptions['subject'] = results.s
moptions['title'] = results.t
moptions['from_email'] = results.f
moptions['from_name'] = results.n
moptions['to_name'] = results.r
moptions['template_id'] = results.p

mailchimp = MailSnake(results.k)

newsletter = results.m.read()
results.m.close

markdowner = markdown2.Markdown()
mhtml = markdowner.convert(newsletter)
mtext = ''.join(BeautifulSoup(mhtml).findAll(text=True))

mcontent = {}
mcontent['html_MAIN'] = mhtml
mcontent['text'] = mtext

campaignid = mailchimp.campaignCreate(type='regular', options=moptions, content=mcontent)
print 'Campaign sucessfully posted to Mailchimp as:' + campaignid
开发者ID:rjmolesa,项目名称:gitdownchimpy,代码行数:32,代码来源:gitdownchim.py


注:本文中的mailsnake.MailSnake.campaignCreate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。