Mercurial > public > sg101
comparison core/tasks.py @ 892:79a71b9d0a2a
Use Reply-To header when sending mail from other users.
See issue #81.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Mon, 16 Feb 2015 20:30:48 -0600 |
parents | aeafbf3ecebf |
children |
comparison
equal
deleted
inserted
replaced
891:24fc302f9076 | 892:79a71b9d0a2a |
---|---|
2 Celery tasks for the core application. | 2 Celery tasks for the core application. |
3 | 3 |
4 """ | 4 """ |
5 from __future__ import absolute_import | 5 from __future__ import absolute_import |
6 | 6 |
7 import django.core.mail | |
7 from celery import shared_task | 8 from celery import shared_task |
8 import django.core.mail | |
9 | 9 |
10 import core.whos_online | 10 import core.whos_online |
11 | 11 |
12 | 12 |
13 @shared_task | 13 @shared_task |
14 def send_mail(subject, message, from_email, recipient_list, **kwargs): | 14 def send_mail(**kwargs): |
15 """ | 15 """ |
16 A task to send mail via Django. | 16 A task to send mail via Django. |
17 | 17 |
18 kwargs must be a dict of keyword arguments for an EmailMessage. | |
19 | |
18 """ | 20 """ |
19 django.core.mail.send_mail(subject, message, from_email, recipient_list, | 21 msg = django.core.mail.EmailMessage(**kwargs) |
20 **kwargs) | 22 msg.send() |
21 | 23 |
22 | 24 |
23 @shared_task | 25 @shared_task |
24 def cleanup(): | 26 def cleanup(): |
25 """ | 27 """ |