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)
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)
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)
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:
@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)