コード例 #1
0
def new_bounty_acceptance(bounty, to_emails=None):
    from dashboard.models import Profile
    from dashboard.utils import get_unrated_bounties_count
    if not bounty or not bounty.value_in_usdt_now:
        return

    if to_emails is None:
        to_emails = []

    subject = gettext("🌈 Funds Paid for {} 🌈").format(bounty.title_or_desc)

    for to_email in to_emails:
        cur_language = translation.get_language()
        profile = Profile.objects.filter(email=to_email).first()
        unrated_count = get_unrated_bounties_count(profile)
        try:
            setup_lang(to_email)
            from_email = settings.CONTACT_EMAIL
            html, text = render_new_bounty_acceptance(to_email, bounty,
                                                      unrated_count)

            if not should_suppress_notification_email(to_email, 'bounty'):
                send_mail(from_email,
                          to_email,
                          subject,
                          text,
                          html,
                          categories=['transactional',
                                      func_name()])
        finally:
            translation.activate(cur_language)
コード例 #2
0
ファイル: mails.py プロジェクト: mfwarren/web
def new_bounty_acceptance(bounty, to_emails=None):
    if not bounty or not bounty.value_in_usdt_now:
        return

    if to_emails is None:
        to_emails = []

    subject = gettext("🌈 Funds Paid for {} 🌈").format(bounty.title_or_desc)

    for to_email in to_emails:
        cur_language = translation.get_language()
        try:
            setup_lang(to_email)
            from_email = settings.CONTACT_EMAIL
            html, text = render_new_bounty_acceptance(to_email, bounty)

            if not should_suppress_notification_email(to_email, 'bounty'):
                send_mail(from_email,
                          to_email,
                          subject,
                          text,
                          html,
                          categories=['transactional',
                                      func_name()])
        finally:
            translation.activate(cur_language)
コード例 #3
0
def new_bounty_acceptance(bounty, to_emails=None):
    if not bounty or not bounty.value_in_usdt:
        return

    if to_emails is None:
        to_emails = []

    subject = "🌈 Funds Paid for {} 🌈".format(bounty.title_or_desc)

    for to_email in to_emails:
        from_email = settings.CONTACT_EMAIL
        html, text = render_new_bounty_acceptance(to_email, bounty)

        if not should_suppress_notification_email(to_email):
            send_mail(from_email, to_email, subject, text, html)