本文整理匯總了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
示例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
示例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