示例#1
0
def send_upgrade_email(addon, new_version, sdk_version):
    cxn = get_email_backend()
    subject = u"%s updated to SDK version %s" % (addon.name, sdk_version)
    from_ = settings.DEFAULT_FROM_EMAIL
    to = set(addon.authors.values_list("email", flat=True))
    t = jingo.env.get_template("files/jetpack_upgraded.txt")
    msg = t.render({"addon": addon, "new_version": new_version, "sdk_version": sdk_version})
    django.core.mail.send_mail(subject, msg, from_, to, connection=cxn)
示例#2
0
文件: tasks.py 项目: 21echoes/zamboni
def send_upgrade_email(addon, new_version, sdk_version):
    cxn = get_email_backend()
    subject = u'%s updated to SDK version %s' % (addon.name, sdk_version)
    from_ = settings.DEFAULT_FROM_EMAIL
    to = set(addon.authors.values_list('email', flat=True))
    t = jingo.env.get_template('files/jetpack_upgraded.txt')
    msg = t.render(addon=addon, new_version=new_version,
                   sdk_version=sdk_version)
    django.core.mail.send_mail(subject, msg, from_, to, connection=cxn)
示例#3
0
文件: tasks.py 项目: lissyx/zamboni
def send_upgrade_email(addon, new_version, sdk_version):
    cxn = get_email_backend()
    subject = u'%s updated to SDK version %s' % (addon.name, sdk_version)
    from_ = settings.DEFAULT_FROM_EMAIL
    to = set(addon.authors.values_list('email', flat=True))
    t = jingo.env.get_template('files/jetpack_upgraded.txt')
    msg = t.render({'addon': addon, 'new_version': new_version,
                    'sdk_version': sdk_version})
    django.core.mail.send_mail(subject, msg, from_, to, connection=cxn)
示例#4
0
    recipient,
    subject,
    message,
    from_email=None,
    html_message=None,
    attachments=None,
    real_email=False,
    cc=None,
    headers=None,
    fail_silently=False,
    async=False,
    max_retries=None,
    **kwargs
):
    backend = EmailMultiAlternatives if html_message else EmailMessage
    connection = get_email_backend(real_email)
    result = backend(
        subject, message, from_email, recipient, cc=cc, connection=connection, headers=headers, attachments=attachments
    )
    if html_message:
        result.attach_alternative(html_message, "text/html")
    try:
        result.send(fail_silently=False)
        return True
    except Exception as e:
        log.error("send_mail failed with error: %s" % e)
        if async:
            return send_email.retry(exc=e, max_retries=max_retries)
        elif not fail_silently:
            raise
        else:
示例#5
0
@task
def send_email(recipient,
               subject,
               message,
               from_email=None,
               html_message=None,
               attachments=None,
               real_email=False,
               cc=None,
               headers=None,
               fail_silently=False,
               async=False,
               max_retries=None,
               **kwargs):
    backend = EmailMultiAlternatives if html_message else EmailMessage
    connection = get_email_backend(real_email)
    result = backend(subject,
                     message,
                     from_email,
                     recipient,
                     cc=cc,
                     connection=connection,
                     headers=headers,
                     attachments=attachments)
    if html_message:
        result.attach_alternative(html_message, 'text/html')
    try:
        result.send(fail_silently=False)
        return True
    except Exception as e:
        log.error('send_mail failed with error: %s' % e)