Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Таска
- @celery_app.task
- def send_email_for_reset_password(email_message):
- email_message.send()
- Форма
- def send_mail(self, subject_template_name, email_template_name,
- context, from_email, to_email, html_email_template_name=None):
- """
- Send a django.core.mail.EmailMultiAlternatives to `to_email`.
- """
- subject = loader.render_to_string(subject_template_name, context)
- # Email subject *must not* contain newlines
- subject = ''.join(subject.splitlines())
- body = loader.render_to_string(email_template_name, context)
- email_message = EmailMultiAlternatives(subject, body, from_email, [to_email])
- if html_email_template_name is not None:
- html_email = loader.render_to_string(html_email_template_name, context)
- email_message.attach_alternative(html_email, 'text/html')
- send_email_for_reset_password.delay(email)
Add Comment
Please, Sign In to add comment