Mercurial > public > sg101
comparison gpp/core/functions.py @ 252:e3958aacd8dd
Adding a way to expedite mail by bypassing the mail queue.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Mon, 20 Sep 2010 00:40:01 +0000 |
parents | 27bee3ac85e6 |
children | 767cedc7d12a |
comparison
equal
deleted
inserted
replaced
251:8525fb4109cc | 252:e3958aacd8dd |
---|---|
7 from django.conf import settings | 7 from django.conf import settings |
8 | 8 |
9 import mailer | 9 import mailer |
10 | 10 |
11 | 11 |
12 def send_mail(subject, message, from_email, recipient_list, | 12 def send_mail(subject, message, from_email, recipient_list, |
13 fail_silently = False, auth_user = None, auth_password = None): | 13 fail_silently=False, auth_user=None, auth_password=None, |
14 expedite=False): | |
14 """The main gpp send email function. | 15 """The main gpp send email function. |
15 Use this function to send email from the site. It will obey debug settings and | 16 Use this function to send email from the site. It will obey debug settings and |
16 log all emails. | 17 log all emails. The expedite flag, when True, will bypass the mail queue. |
17 """ | 18 """ |
18 | 19 |
19 if settings.MAILER_ENQUEUE_MAIL: | 20 if settings.MAILER_ENQUEUE_MAIL and not expedite: |
20 mailer.enqueue_mail(subject, message, from_email, recipient_list) | 21 mailer.enqueue_mail(subject, message, from_email, recipient_list) |
21 elif settings.GPP_SEND_EMAIL: | 22 elif settings.GPP_SEND_EMAIL: |
22 django.core.mail.send_mail(subject, message, from_email, recipient_list, | 23 django.core.mail.send_mail(subject, message, from_email, recipient_list, |
23 fail_silently, auth_user, auth_password) | 24 fail_silently, auth_user, auth_password) |
24 | 25 |