• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python mail.send_mail_jinja函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中mkt.site.mail.send_mail_jinja函数的典型用法代码示例。如果您正苦于以下问题:Python send_mail_jinja函数的具体用法?Python send_mail_jinja怎么用?Python send_mail_jinja使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: email_recipients

def email_recipients(recipients, note, template=None, extra_context=None):
    """
    Given a list of tuple of user_id/user_email, email bunch of people.
    note -- commbadge note, the note type determines which email to use.
    template -- override which template we use.
    """
    subject = '%s: %s' % (unicode(comm.NOTE_TYPES[note.note_type]),
                          note.thread.obj.name)

    for email, user_id, tok in tokenize_recipients(recipients, note.thread):
        headers = {}
        if tok:
            headers['Reply-To'] = '{0}{1}@{2}'.format(
                comm.REPLY_TO_PREFIX, tok, settings.POSTFIX_DOMAIN)

        # Get the appropriate mail template.
        mail_template = template or comm.COMM_MAIL_MAP.get(note.note_type,
                                                           'generic')

        # Send mail.
        context = get_mail_context(note, user_id)
        context.update(extra_context or {})
        send_mail_jinja(subject, 'comm/emails/%s.html' % mail_template,
                        context, recipient_list=[email],
                        from_email=settings.MKT_REVIEWERS_EMAIL,
                        perm_setting='app_reviewed', headers=headers)
开发者ID:Witia1,项目名称:zamboni,代码行数:26,代码来源:utils_mail.py


示例2: email_daily_ratings

def email_daily_ratings():
    """
    Does email for yesterday's ratings (right after the day has passed).
    Sends an email containing all reviews for that day for certain app.
    """
    dt = datetime.datetime.today() - datetime.timedelta(1)
    yesterday = datetime.datetime(dt.year, dt.month, dt.day, 0, 0, 0)
    today = yesterday + datetime.timedelta(1)
    pretty_date = '%04d-%02d-%02d' % (dt.year, dt.month, dt.day)

    yesterday_reviews = Review.objects.filter(created__gte=yesterday,
                                              created__lt=today)

    # For each app in yesterday's set of reviews, gather reviews and email out.
    apps = set(review.addon for review in yesterday_reviews)
    for app in apps:
        # Email all reviews in one email for current app in loop.
        author_emails = app.authors.values_list('email', flat=True)
        subject = 'Firefox Marketplace reviews for %s on %s' % (app.name,
                                                                pretty_date)

        context = {'reviews': (yesterday_reviews.filter(addon=app).
                               order_by('-created')),
                   'base_url': settings.SITE_URL,
                   'pretty_date': pretty_date}

        send_mail_jinja(subject, 'ratings/emails/daily_digest.html',
                        context, recipient_list=author_emails,
                        perm_setting='app_new_review', async=True)
开发者ID:Fjoerfoks,项目名称:zamboni,代码行数:29,代码来源:cron.py


示例3: send_mail_comm

def send_mail_comm(note):
    """
    Email utility used globally by the Communication Dashboard to send emails.
    Given a note (its actions and permissions), recipients are determined and
    emails are sent to appropriate people.
    """
    log.info(u'Sending emails for %s' % note.thread.obj)

    if note.note_type in comm.EMAIL_SENIOR_REVIEWERS_AND_DEV:
        # Email senior reviewers (such as for escalations).
        rev_template = comm.EMAIL_SENIOR_REVIEWERS_AND_DEV[note.note_type][
            'reviewer']
        email_recipients(get_senior_reviewers(), note, template=rev_template)

        # Email developers (such as for escalations).
        dev_template = comm.EMAIL_SENIOR_REVIEWERS_AND_DEV[note.note_type][
            'developer']
        email_recipients(get_developers(note), note, template=dev_template)
    else:
        email_recipients(get_recipients(note), note)

        # Also send mail to the fallback emailing list.
        if note.note_type == comm.DEVELOPER_COMMENT:
            subject = '%s: %s' % (unicode(comm.NOTE_TYPES[note.note_type]),
                                  note.thread.obj.name)
            mail_template = comm.COMM_MAIL_MAP.get(note.note_type, 'generic')
            send_mail_jinja(subject, 'comm/emails/%s.html' % mail_template,
                            get_mail_context(note, None),
                            recipient_list=[settings.MKT_REVIEWS_EMAIL],
                            from_email=settings.MKT_REVIEWERS_EMAIL,
                            perm_setting='app_reviewed')
开发者ID:Witia1,项目名称:zamboni,代码行数:31,代码来源:utils_mail.py


示例4: email_daily_ratings

def email_daily_ratings():
    """
    Does email for yesterday's ratings (right after the day has passed).
    Sends an email containing all reviews for that day for certain app.
    """
    dt = datetime.datetime.today() - datetime.timedelta(1)
    yesterday = datetime.datetime(dt.year, dt.month, dt.day, 0, 0, 0)
    today = yesterday + datetime.timedelta(1)
    pretty_date = "%04d-%02d-%02d" % (dt.year, dt.month, dt.day)

    yesterday_reviews = Review.objects.filter(created__gte=yesterday, created__lt=today, addon__type=amo.ADDON_WEBAPP)

    # For each app in yesterday's set of reviews, gather reviews and email out.
    apps = set(review.addon for review in yesterday_reviews)
    for app in apps:
        # Email all reviews in one email for current app in loop.
        author_emails = app.authors.values_list("email", flat=True)
        subject = "Firefox Marketplace reviews for %s on %s" % (app.name, pretty_date)

        context = {
            "reviews": (yesterday_reviews.filter(addon=app).order_by("-created")),
            "base_url": settings.SITE_URL,
            "pretty_date": pretty_date,
        }

        send_mail_jinja(
            subject,
            "ratings/emails/daily_digest.html",
            context,
            recipient_list=author_emails,
            perm_setting="app_new_review",
            async=True,
        )
开发者ID:gurumukhi,项目名称:zamboni,代码行数:33,代码来源:cron.py


示例5: send_tarako_mail

def send_tarako_mail(review):
    if not waffle.switch_is_active('comm-dashboard'):
        send_mail_jinja(
            'Low-memory devices review {passed}'.format(
                passed='passed' if review.passed else 'failed'),
            'reviewers/emails/tarako_review_complete.txt',
            {'review': review},
            recipient_list=[a.email for a in review.app.authors.all()],
            from_email=settings.MKT_REVIEWERS_EMAIL)
开发者ID:MaxMillion,项目名称:zamboni,代码行数:9,代码来源:models.py


示例6: send_reviewer_mail

def send_reviewer_mail(subject, template, context, emails, perm_setting=None, cc=None,
              attachments=None, reply_to=None):
    if not reply_to:
        reply_to = settings.MKT_REVIEWERS_EMAIL

    # Link to our newfangled "Account Settings" page.
    manage_url = absolutify('/settings') + '#notifications'
    send_mail_jinja(subject, template, context, recipient_list=emails,
                    from_email=settings.MKT_REVIEWERS_EMAIL,
                    use_blacklist=False, perm_setting=perm_setting,
                    manage_url=manage_url, headers={'Reply-To': reply_to},
                    cc=cc, attachments=attachments)
开发者ID:MorrisJobke,项目名称:zamboni,代码行数:12,代码来源:utils.py


示例7: record_failed_refund

 def record_failed_refund(self, e, user):
     self.enqueue_refund(amo.REFUND_FAILED, user,
                         rejection_reason=str(e))
     self._switch_locale()
     self._mail('users/support/emails/refund-failed.txt',
                # L10n: the addon name.
                _(u'%s refund failed' % self.addon.name),
                {'name': self.addon.name})
     send_mail_jinja(
         'Refund failed', 'purchase/email/refund-failed.txt',
         {'name': self.user.email,
          'error': str(e)},
         settings.MARKETPLACE_EMAIL,
         [str(self.addon.support_email)], fail_silently=True)
开发者ID:MorrisJobke,项目名称:zamboni,代码行数:14,代码来源:models.py


示例8: patch

    def patch(self, request, *args, **kwargs):
        form = FailureForm(request.DATA)
        if not form.is_valid():
            return Response(form.errors, status=status.HTTP_400_BAD_REQUEST)

        obj = self.get_object()
        data = {
            'transaction_id': obj,
            'transaction_url': absolutify(
                urlparams(reverse('mkt.developers.transactions'),
                          transaction_id=obj.uuid)),
            'url': form.cleaned_data['url'],
            'retries': form.cleaned_data['attempts']}
        owners = obj.addon.authors.values_list('email', flat=True)
        send_mail_jinja('Payment notification failure.',
                        'webpay/failure.txt',
                        data, recipient_list=owners)
        return Response(status=status.HTTP_202_ACCEPTED)
开发者ID:MorrisJobke,项目名称:zamboni,代码行数:18,代码来源:views.py


示例9: region_email

def region_email(ids, region_ids, **kw):
    regions = [REGIONS_CHOICES_ID_DICT[id] for id in region_ids]
    region_names = regions = sorted([unicode(r.name) for r in regions])

    # Format the region names with commas and fanciness.
    if len(regions) == 2:
        suffix = 'two'
        region_names = ' '.join([regions[0], _(u'and'), regions[1]])
    else:
        if len(regions) == 1:
            suffix = 'one'
        elif len(regions) > 2:
            suffix = 'many'
            region_names[-1] = _(u'and') + ' ' + region_names[-1]
        region_names = ', '.join(region_names)

    log.info('[%[email protected]%s] Emailing devs about new region(s): %s.' %
             (len(ids), region_email.rate_limit, region_names))

    for id_ in ids:
        log.info('[Webapp:%s] Emailing devs about new region(s): %s.' %
                 (id_, region_names))

        product = Webapp.objects.get(id=id_)
        to = set(product.authors.values_list('email', flat=True))

        if len(regions) == 1:
            subject = _(
                u'{region} region added to the Firefox Marketplace').format(
                    region=regions[0])
        else:
            subject = _(u'New regions added to the Firefox Marketplace')

        dev_url = absolutify(product.get_dev_url('edit'),
                             settings.SITE_URL) + '#details'
        context = {'app': product.name,
                   'regions': region_names,
                   'dev_url': dev_url}
        send_mail_jinja('%s: %s' % (product.name, subject),
                        'developers/emails/new_regions_%s.ltxt' % suffix,
                        context, recipient_list=to,
                        perm_setting='app_regions')
开发者ID:kolyaflash,项目名称:zamboni,代码行数:42,代码来源:tasks.py


示例10: region_email

def region_email(ids, region_ids, **kw):
    regions = [REGIONS_CHOICES_ID_DICT[id] for id in region_ids]
    region_names = regions = sorted([unicode(r.name) for r in regions])

    # Format the region names with commas and fanciness.
    if len(regions) == 2:
        suffix = "two"
        region_names = " ".join([regions[0], _(u"and"), regions[1]])
    else:
        if len(regions) == 1:
            suffix = "one"
        elif len(regions) > 2:
            suffix = "many"
            region_names[-1] = _(u"and") + " " + region_names[-1]
        region_names = ", ".join(region_names)

    log.info("[%[email protected]%s] Emailing devs about new region(s): %s." % (len(ids), region_email.rate_limit, region_names))

    for id_ in ids:
        log.info("[Webapp:%s] Emailing devs about new region(s): %s." % (id_, region_names))

        product = Webapp.objects.get(id=id_)
        to = set(product.authors.values_list("email", flat=True))

        if len(regions) == 1:
            subject = _(u"{region} region added to the Firefox Marketplace").format(region=regions[0])
        else:
            subject = _(u"New regions added to the Firefox Marketplace")

        dev_url = absolutify(product.get_dev_url("edit"), settings.SITE_URL) + "#details"
        context = {"app": product.name, "regions": region_names, "dev_url": dev_url}
        send_mail_jinja(
            "%s: %s" % (product.name, subject),
            "developers/emails/new_regions_%s.ltxt" % suffix,
            context,
            recipient_list=to,
            perm_setting="app_regions",
        )
开发者ID:jamesthechamp,项目名称:zamboni,代码行数:38,代码来源:tasks.py


示例11: email_buyer_refund_pending

def email_buyer_refund_pending(contrib):
    send_mail_jinja('Your refund request for %s is now being processed'
                    % contrib.addon.name,
                    'lookup/emails/refund-pending.txt',
                    {'name': contrib.addon.name},
                    recipient_list=[contrib.user.email]),
开发者ID:MorrisJobke,项目名称:zamboni,代码行数:6,代码来源:tasks.py


示例12: email_buyer_refund_approved

def email_buyer_refund_approved(contrib):
    send_mail_jinja('Your refund request for %s has been approved!'
                    % contrib.addon.name,
                    'lookup/emails/refund-approved.txt',
                    {'name': contrib.addon.name},
                    recipient_list=[contrib.user.email]),
开发者ID:MorrisJobke,项目名称:zamboni,代码行数:6,代码来源:tasks.py


示例13: create_action

 def create_action(self, request, serializer):
     context_data = self.get_context_data(request, serializer)
     sender = getattr(request.user, 'email', settings.NOBODY_EMAIL)
     send_mail_jinja(u'Marketplace Feedback', 'account/email/feedback.txt',
                     context_data, headers={'Reply-To': sender},
                     recipient_list=[settings.MKT_APPS_FEEDBACK_EMAIL])
开发者ID:Witia1,项目名称:zamboni,代码行数:6,代码来源:views.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python messages.error函数代码示例发布时间:2022-05-27
下一篇:
Python mail.send_mail函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap