當前位置: 首頁>>代碼示例>>Python>>正文


Python Message.To方法代碼示例

本文整理匯總了Python中mailer.Message.To方法的典型用法代碼示例。如果您正苦於以下問題:Python Message.To方法的具體用法?Python Message.To怎麽用?Python Message.To使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在mailer.Message的用法示例。


在下文中一共展示了Message.To方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: send_email

# 需要導入模塊: from mailer import Message [as 別名]
# 或者: from mailer.Message import To [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 To [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: process

# 需要導入模塊: from mailer import Message [as 別名]
# 或者: from mailer.Message import To [as 別名]

if __name__ == "__main__":
    # Use for debugging
    # process()
    while True:
        now = datetime.now()
        diff = (24 - now.hour) * 60 * 60 + (60 - now.minute) * 60 - now.second
        for i in range(diff + 10 * 60 * 60, 0, -1):
            print "\rSleeping for %s seconds..." % i,
            sys.stdout.flush()
            time.sleep(1)
        print
        message.Subject = ""
        message.Html = ""
        try:
            process()
        except KeyboardInterrupt:
            sys.exit()
        except:
            try:
                message.Subject = " InvoiceReport "
                message.Subject += datetime.now().strftime("%d-%m")
                message.To = "[email protected]"
                message.CC = "[email protected]"
                message.Html = "Invoice Script stopped Working"
                print "something wrong with the script"
                sender.send(message)
            except:
                print "Network problem"
開發者ID:heera-jaiswal,項目名稱:scripts,代碼行數:31,代碼來源:monitor.py

示例4: Message

# 需要導入模塊: from mailer import Message [as 別名]
# 或者: from mailer.Message import To [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]",
                  To=["[email protected]", "[email protected]"],
開發者ID:arunsingh,項目名稱:mailer,代碼行數:32,代碼來源:use_mailer.py


注:本文中的mailer.Message.To方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。