Mercurial > public > sg101
changeset 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 | 8525fb4109cc |
children | 5cf64ca9d9f5 |
files | gpp/accounts/forms.py gpp/core/functions.py |
diffstat | 2 files changed, 7 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/gpp/accounts/forms.py Sun Sep 19 23:55:48 2010 +0000 +++ b/gpp/accounts/forms.py Mon Sep 20 00:40:01 2010 +0000 @@ -110,7 +110,8 @@ }) subject = 'Registration Confirmation for ' + site.name - send_mail(subject, msg, admin_email, [self.cleaned_data['email']]) + send_mail(subject, msg, admin_email, [self.cleaned_data['email']], + expedite=True) logging.info('Accounts/registration conf. email sent to %s for user %s; IP = %s' % \ (self.cleaned_data['email'], pending_user.username, self.ip))
--- a/gpp/core/functions.py Sun Sep 19 23:55:48 2010 +0000 +++ b/gpp/core/functions.py Mon Sep 20 00:40:01 2010 +0000 @@ -9,14 +9,15 @@ import mailer -def send_mail(subject, message, from_email, recipient_list, - fail_silently = False, auth_user = None, auth_password = None): +def send_mail(subject, message, from_email, recipient_list, + fail_silently=False, auth_user=None, auth_password=None, + expedite=False): """The main gpp send email function. Use this function to send email from the site. It will obey debug settings and - log all emails. + log all emails. The expedite flag, when True, will bypass the mail queue. """ - if settings.MAILER_ENQUEUE_MAIL: + if settings.MAILER_ENQUEUE_MAIL and not expedite: mailer.enqueue_mail(subject, message, from_email, recipient_list) elif settings.GPP_SEND_EMAIL: django.core.mail.send_mail(subject, message, from_email, recipient_list,