本文整理汇总了Python中mail.Mail.send_template方法的典型用法代码示例。如果您正苦于以下问题:Python Mail.send_template方法的具体用法?Python Mail.send_template怎么用?Python Mail.send_template使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mail.Mail
的用法示例。
在下文中一共展示了Mail.send_template方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: send_multiple_photo_mail
# 需要导入模块: from mail import Mail [as 别名]
# 或者: from mail.Mail import send_template [as 别名]
def send_multiple_photo_mail(to_dest, moment_name, photos, photos_unique):
m = Mail()
contenu = unicode(' : 6 Nouvelles Photos !','utf-8')
subject = "%s %s" % ( moment_name, contenu)
template_name = constants.MULTIPLE_PHOTO_TEMPLATE
template_args = []
#Global Var
global_merge_vars = []
#For each photo we send the url
count = 1
for photo in photos:
name = "photo_url_%s" % count
global_photo = {
"name" : name,
"content" : photo
}
count += 1
global_merge_vars.append(global_photo)
countUnique = 1
for photoUnique in photos_unique:
name = "photo_unique_%s" % countUnique
global_photo_unique = {
"name" : name,
"content" : photoUnique
}
countUnique += 1
global_merge_vars.append(global_photo_unique)
global_nb_photos = {
"name" : "nb_photos",
"content" : len(photos)
}
global_merge_vars.append(global_nb_photos)
global_moment = {
"name" : "moment_name",
"content" : moment_name
}
global_merge_vars.append(global_moment)
m.send_template(subject, template_name, template_args, to_dest, global_merge_vars)
示例2: send_inscrption_mail
# 需要导入模块: from mail import Mail [as 别名]
# 或者: from mail.Mail import send_template [as 别名]
def send_inscrption_mail(firstname, lastname, mail):
m = Mail()
subject = "Confirmation Inscription"
template_name = constants.INSCRIPTION_TEMPLATE
template_args = []
destArray = []
dest = {
"email" : mail,
"name" : firstname + " " + lastname
}
destArray.append(dest)
m.send_template(subject, template_name, template_args, destArray)
示例3: send_report_cron
# 需要导入模块: from mail import Mail [as 别名]
# 或者: from mail.Mail import send_template [as 别名]
def send_report_cron(to_dest, time_spent, nb_moment, nb_users):
m = Mail()
contenu = unicode("Rapport du crontab",'utf-8')
subject = "%s" % contenu
template_name = constants.REPORT_CRON
template_args = []
#Global Var
global_merge_vars = []
global_time_spent = {
"name" : "time_spent",
"content" : time_spent
}
global_nb_moment = {
"name" : "nb_moment",
"content" : nb_moment
}
global_nb_users = {
"name" : "nb_user",
"content" : nb_users
}
global_merge_vars.append(global_time_spent)
global_merge_vars.append(global_nb_moment)
global_merge_vars.append(global_nb_users)
m.send_template(subject, template_name, template_args, to_dest, global_merge_vars)
示例4: send_new_pass_mail
# 需要导入模块: from mail import Mail [as 别名]
# 或者: from mail.Mail import send_template [as 别名]
def send_new_pass_mail(to_dest, new_pass):
m = Mail()
contenu = unicode("Génération d'un nouveau mot de passe ",'utf-8')
subject = "%s" % contenu
template_name = constants.NEW_PASS_TEMPLATE
template_args = []
#Global Var
global_merge_vars = []
global_password = {
"name" : "new_password",
"content" : new_pass
}
global_merge_vars.append(global_password)
m.send_template(subject, template_name, template_args, to_dest, global_merge_vars)
示例5: send_bde_infos
# 需要导入模块: from mail import Mail [as 别名]
# 或者: from mail.Mail import send_template [as 别名]
def send_bde_infos(infos):
m = Mail()
subject = "Mail pour concours BDE"
template_name = "bde-challenge"
template_args = []
#Global Var
global_merge_vars = []
global_name_event = {
"name" : "name_event",
"content" : infos["name_event"]
}
global_email_compte= {
"name" : "email_compte",
"content" : infos["email_compte"]
}
global_date_event = {
"name" : "date_event",
"content" : infos["date_event"]
}
global_description_event = {
"name" : "description_event",
"content" : infos["description_event"]
}
global_student_name = {
"name" : "student_name",
"content" : infos["student_name"]
}
global_assos_name = {
"name" : "assos_name",
"content" : infos["assos_name"]
}
global_assos_email = {
"name" : "assos_email",
"content" : infos["assos_email"]
}
global_tel_assos = {
"name" : "tel_assos",
"content" : infos["tel_assos"]
}
global_merge_vars.append(global_name_event)
global_merge_vars.append(global_email_compte)
global_merge_vars.append(global_date_event)
global_merge_vars.append(global_description_event)
global_merge_vars.append(global_student_name)
global_merge_vars.append(global_assos_name)
global_merge_vars.append(global_assos_email)
global_merge_vars.append(global_tel_assos)
to_dests = []
dest = {
"email" : "[email protected]",
"name" : "Moment"
}
to_dests.append(dest)
m.send_template(subject, template_name, template_args, to_dests, global_merge_vars)
示例6: send_report_stats
# 需要导入模块: from mail import Mail [as 别名]
# 或者: from mail.Mail import send_template [as 别名]
def send_report_stats(to_dest, time_spent, env, stats):
m = Mail()
contenu = unicode("Stats du ",'utf-8')
yesterday = datetime.date.today() - datetime.timedelta(days=1)
subject = "%s %s" % (contenu, yesterday.strftime("%d/%m/%y"))
template_name = constants.MAIL_STATS
template_args = []
#Global Var
global_merge_vars = []
global_nb_new_moments = {
"name" : "new_moments",
"content" : stats["new_moments"]
}
global_nb_moments_total = {
"name" : "nb_moments_total",
"content" : stats["nb_moments_total"]
}
global_nb_fb_events = {
"name" : "fb_events",
"content" : stats["fb_events"]
}
global_nb_fb_events_total = {
"name" : "fb_events_total",
"content" : stats["fb_events_total"]
}
global_new_users = {
"name" : "new_users",
"content" : stats["new_users"]
}
global_users_total = {
"name" : "users_total",
"content" : stats["users_total"]
}
global_new_invits = {
"name" : "new_invits",
"content" : stats["new_invits"]
}
global_total_invits = {
"name" : "total_invits",
"content" : stats["total_invits"]
}
global_photos_new = {
"name" : "photos_new",
"content" : stats["photos_new"]
}
global_photos_total = {
"name" : "photos_total",
"content" : stats["photos_total"]
}
global_time_spent = {
"name" : "time_spent",
"content" : time_spent
}
global_env = {
"name" : "env",
"content" : env
}
global_merge_vars.append(global_nb_new_moments)
global_merge_vars.append(global_nb_moments_total)
global_merge_vars.append(global_nb_fb_events)
global_merge_vars.append(global_nb_fb_events_total)
global_merge_vars.append(global_new_users)
global_merge_vars.append(global_users_total)
global_merge_vars.append(global_new_invits)
global_merge_vars.append(global_total_invits)
global_merge_vars.append(global_photos_new)
global_merge_vars.append(global_photos_total)
global_merge_vars.append(global_time_spent)
global_merge_vars.append(global_env)
m.send_template(subject, template_name, template_args, to_dest, global_merge_vars)
示例7: send_single_photo_mail
# 需要导入模块: from mail import Mail [as 别名]
# 或者: from mail.Mail import send_template [as 别名]
def send_single_photo_mail(to_dest, moment_name, user_infos, photo_url, nb_photo_moment, unique_url):
m = Mail()
contenu = unicode(' : Nouvelle photo','utf-8')
subject = "%s %s" % ( moment_name, contenu)
template_name = constants.SINGLE_PHOTO_TEMPLATE
template_args = []
#Global Var
global_merge_vars = []
name = "%s %s" % (user_infos["firstname"], user_infos["lastname"])
global_user_name = {
"name" : "user_name",
"content" : name
}
global_merge_vars.append(global_user_name)
global_firstname = {
"name" : "fn_user",
"content" : user_infos["firstname"]
}
global_merge_vars.append(global_firstname)
global_user_photo = {
"name" : "user_photo",
"content" : user_infos["photo"]
}
global_merge_vars.append(global_user_photo)
global_photo = {
"name" : "image_moment",
"content" : photo_url
}
global_merge_vars.append(global_photo)
global_moment = {
"name" : "moment_name",
"content" : moment_name
}
global_merge_vars.append(global_moment)
global_nb_photo = {
"name" : "nb_photo",
"content" : nb_photo_moment
}
global_merge_vars.append(global_nb_photo)
global_unique_url = {
"name" : "unique_url",
"content" : unique_url
}
global_merge_vars.append(global_unique_url)
m.send_template(subject, template_name, template_args, to_dest, global_merge_vars)