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


Python Message.bcc方法代碼示例

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


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

示例1: send_mail

# 需要導入模塊: from turbomail import Message [as 別名]
# 或者: from turbomail.Message import bcc [as 別名]
def send_mail(subject, body, author=None, **kwargs):
    interface.start(email_config)
    msg = Message(author or from_, parse_mail(kwargs.get('to', [])), subject)
    msg.cc = parse_mail(kwargs.get('cc', []))
    bcc = kwargs.get('bcc', [])
    if not bcc:
        if kwargs.get('debug', True):
            bcc = debug_list

    msg.bcc = parse_mail(bcc)
    msg.plain = subject
    msg.rich = body
    [msg.attach(attachment) for attachment in kwargs.get('attachments', [])]
    msg.send()
    interface.stop()
開發者ID:hlzz23,項目名稱:AssetSystem,代碼行數:17,代碼來源:sendmail.py

示例2: send

# 需要導入模塊: from turbomail import Message [as 別名]
# 或者: from turbomail.Message import bcc [as 別名]
def send(to, template_path, context=None, reply_to='', bcc='[email protected]'):
    """
    Send message based on a mako template. The recipient is automatically added
    to the context_dict that gets fed to the template.
    """

    t = EMAIL_TEMPLATE_LOOKUP.get_template(template_path)
    
    context = context or {}
    context['url_for'] = absolute_url_for
    
    def get_email(u, set_context=True):
        if isinstance(u, users.User):
            if set_context: context['user'] = u
            return u.email
        return u
    
    if isinstance(to, users.User):
        to = get_email(to)
    if isinstance(to, (list, tuple)):
        to = [get_email(u, set_context=False) for u in to]

    pc = pylons.config
    
    subject = t.get_def('subject').render_unicode(**context).strip()
    body = line_reduce(t.render_unicode(**context).strip())
    f = (pc['mail.message.author_name'], pc['mail.message.author'])
    
    reroute = pc.get('mail.reroute')
    if reroute:
        old_to = to
        to = reroute
    
    lmsg = 'Sending email from %s to %s.' % (f, to)
    if reroute:
        lmsg += ' Message was rerouted from %s' % old_to
    logger.info(lmsg)
    
    msg = Message(f, to, subject, plain=body)
    msg.plain = body
    msg.bcc = bcc
    
    if reply_to:
        msg.reply_to = reply_to
    
    msg.send()
    
開發者ID:Nullicopter,項目名稱:Desio,代碼行數:48,代碼來源:email.py


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