本文整理汇总了Python中pixelated.adapter.model.mail.InputMail.headers['Subject']方法的典型用法代码示例。如果您正苦于以下问题:Python InputMail.headers['Subject']方法的具体用法?Python InputMail.headers['Subject']怎么用?Python InputMail.headers['Subject']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pixelated.adapter.model.mail.InputMail
的用法示例。
在下文中一共展示了InputMail.headers['Subject']方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build_welcome_mail
# 需要导入模块: from pixelated.adapter.model.mail import InputMail [as 别名]
# 或者: from pixelated.adapter.model.mail.InputMail import headers['Subject'] [as 别名]
def build_welcome_mail():
current_path = os.path.dirname(os.path.abspath(__file__))
with open(os.path.join(current_path, '..', 'assets', 'welcome.mail')) as mail_template_file:
mail_template = message_from_file(mail_template_file)
welcome_mail = InputMail()
welcome_mail.headers['To'] = InputMail.FROM_EMAIL_ADDRESS
welcome_mail.headers['Subject'] = mail_template['Subject']
welcome_mail.headers['Date'] = iso_now()
welcome_mail._mime = MIMEMultipart()
for payload in mail_template.get_payload():
welcome_mail._mime.attach(payload)
if payload.get_content_type() == 'text/plain':
welcome_mail.body = payload.as_string()
return welcome_mail