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


Python Message.From方法代码示例

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


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

示例1: send_email

# 需要导入模块: from mailer import Message [as 别名]
# 或者: from mailer.Message import From [as 别名]
def send_email(email_props, content):
    """ Helper for sending emails"""
    p = email_props
    mess = Message(charset="utf-8")
    mess.From = p.email_sender
    mess.To = p.email_recipient
    mess.Subject = p.email_subject
    mess.Html = content
    mess.Body = "Please enable HTML in your client to view this message."
    sender = Mailer(p.email_server)

    try:
        sender.send(mess)
        logger.info("Email [{}] was sent to: {}".format(mess.Subject, mess.To))
    except Exception as exc:
        logger.error("Problem sending email [{}] to [{}]: {}"
                     .format(p.email_subject, p.email_recipient, exc))
开发者ID:ctsit,项目名称:redman,代码行数:19,代码来源:fabfile.py

示例2: send_register_mail

# 需要导入模块: from mailer import Message [as 别名]
# 或者: from mailer.Message import From [as 别名]
def send_register_mail(user, pwd):
    message = Message()
    message.From = 'no-reply'
    message.Body = "Ваш пароль: %s" % pwd
    message.To = user['email']
    message.Subject = 'Регистрация в системе'
    try:
        sender.send(message)
        return True
    except (
        smtplib.SMTPAuthenticationError,
        smtplib.SMTPDataError,
        smtplib.SMTPConnectError,
        smtplib.SMTPRecipientsRefused,
        smtplib.SMTPSenderRefused,
        smtplib.SMTPResponseException,
        smtplib.SMTPServerDisconnected,
        smtplib.SMTPHeloError,
        smtplib.SMTPException
    ) as e:
        print(e)
        return False
开发者ID:pupizoid,项目名称:Clothes,代码行数:24,代码来源:mailing.py

示例3: Message

# 需要导入模块: from mailer import Message [as 别名]
# 或者: from mailer.Message import From [as 别名]
"""

from mailer import Mailer
from mailer import Message
import urllib

msg1 = Message(From="[email protected]",
                  To=["[email protected]", "[email protected]"],
                  charset="utf-8")
msg1.Subject = "日本語のHTMLメール"
msg1.Html = """Hello, <b>日本語</b>"""

mailer = Mailer('smtp01.odn.ne.jp')

msg2 = Message(Body="ナイスボディー!", attachments=["picture.png"])
msg2.From = "[email protected]"
msg2.To = "[email protected]"
msg2.Subject = "日本語の添付ファイルメール"
msg2.charset = "utf-8"

mailer.send([msg1, msg2])

msg = Message()
msg.From = "[email protected]"
msg.To = "[email protected]"
msg.Subject = "テキストメール"
msg.Body = "これは日本語のキストメールでございます。"
msg.charset = "utf-8"
mailer.send(msg)

msg3 = Message(From="[email protected]",
开发者ID:arunsingh,项目名称:mailer,代码行数:33,代码来源:use_mailer.py


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