當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。