# HG changeset patch # User Brian Neal # Date 1302989963 0 # Node ID 20af29454e8312c0bbcb8f0d326de41521cf558e # Parent 538a1bd2f1f4bfd67fd4945f9aae7464aab89f29 Fixing #202. Guard against an empty email recipient list to prevent mail errors. We log a warning if this happens. diff -r 538a1bd2f1f4 -r 20af29454e83 gpp/core/functions.py --- a/gpp/core/functions.py Sat Apr 16 19:30:29 2011 +0000 +++ b/gpp/core/functions.py Sat Apr 16 21:39:23 2011 +0000 @@ -17,6 +17,10 @@ Use this function to send email from the site. It will obey debug settings and log all emails. The expedite flag, when True, will bypass the mail queue. """ + recipient_list = [dest for dest in recipient_list if dest] + if not recipient_list: + logging.warning("Empty recipient_list in send_mail") + return if settings.MAILER_ENQUEUE_MAIL and not expedite: mailer.enqueue_mail(subject, message, from_email, recipient_list)