All the nightly/weekly/nag messages were going to whoever happened to get the first nag message. Silly bug.
authorBenjamin Smedberg <benjamin@smedbergs.us>
Tue, 15 Dec 2009 13:21:08 -0500
changeset 20 576078244fc5
parent 19 5710c4c527cc
child 21 97f2d5b5e686
push id17
push userbsmedberg@mozilla.com
push date2009-12-15 18:21 +0000
All the nightly/weekly/nag messages were going to whoever happened to get the first nag message. Silly bug.
weeklyupdates/mail.py
--- a/weeklyupdates/mail.py
+++ b/weeklyupdates/mail.py
@@ -16,22 +16,28 @@ def sendmails(messages, fromaddress=None
     smtpuser = app.config['weeklyupdates'].get('smtp.username', None)
     smtppass = app.config['weeklyupdates'].get('smtp.password', None)
 
     session = smtplib.SMTP(smtpserver)
     if smtpuser is not None:
         session.login(smtpuser, smtppass)
 
     for message in messages:
-        if fromaddress is None:
-            fromaddress = message['From']
-        if recipientlist is None:
-            recipientlist = [message['To']]
+        if fromaddress is not None:
+            messagefrom = fromaddress
+        else:
+            messagefrom = message['From']
+
+        if recipientlist is not None:
+            messageto = recipientlist
+        else:
+            messageto = [message['To']]
+
         try:
-            session.sendmail(fromaddress, recipientlist, message.as_string())
+            session.sendmail(messagefrom, messageto, message.as_string())
         except AttributeError, e:
             print e
             try:
                 print "Exception sending mail from %r to %r" % (fromaddress, recipientlist)
             except:
                 pass
     session.quit()