# HG changeset patch # User Brian Neal # Date 1284943201 0 # Node ID e3958aacd8dd548c533351cb78c2baf4b2790468 # Parent 8525fb4109cc2ee909f0cf1cb534a67011a356d5 Adding a way to expedite mail by bypassing the mail queue. diff -r 8525fb4109cc -r e3958aacd8dd gpp/accounts/forms.py --- 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)) diff -r 8525fb4109cc -r e3958aacd8dd gpp/core/functions.py --- 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,