Mercurial > public > sg101
comparison gpp/core/functions.py @ 418:20af29454e83
Fixing #202. Guard against an empty email recipient list to prevent mail errors. We log a warning if this happens.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sat, 16 Apr 2011 21:39:23 +0000 |
parents | 767cedc7d12a |
children | 9e7ae8462f3f |
comparison
equal
deleted
inserted
replaced
417:538a1bd2f1f4 | 418:20af29454e83 |
---|---|
15 expedite=False): | 15 expedite=False): |
16 """The main gpp send email function. | 16 """The main gpp send email function. |
17 Use this function to send email from the site. It will obey debug settings and | 17 Use this function to send email from the site. It will obey debug settings and |
18 log all emails. The expedite flag, when True, will bypass the mail queue. | 18 log all emails. The expedite flag, when True, will bypass the mail queue. |
19 """ | 19 """ |
20 recipient_list = [dest for dest in recipient_list if dest] | |
21 if not recipient_list: | |
22 logging.warning("Empty recipient_list in send_mail") | |
23 return | |
20 | 24 |
21 if settings.MAILER_ENQUEUE_MAIL and not expedite: | 25 if settings.MAILER_ENQUEUE_MAIL and not expedite: |
22 mailer.enqueue_mail(subject, message, from_email, recipient_list) | 26 mailer.enqueue_mail(subject, message, from_email, recipient_list) |
23 elif settings.GPP_SEND_EMAIL: | 27 elif settings.GPP_SEND_EMAIL: |
24 django.core.mail.send_mail(subject, message, from_email, recipient_list, | 28 django.core.mail.send_mail(subject, message, from_email, recipient_list, |