bug: do not crash when To: header is not found v1.1
authorStefan Huber <shuber@sthu.org>
Tue, 7 Jan 2014 18:20:24 +0000 (19:20 +0100)
committerStefan Huber <shuber@sthu.org>
Tue, 7 Jan 2014 18:20:24 +0000 (19:20 +0100)
smailq

diff --git a/smailq b/smailq
index c42b980..7d5286a 100755 (executable)
--- a/smailq
+++ b/smailq
@@ -160,6 +160,8 @@ class MailQueue:
         info = {}
         info['ctime'] = time.ctime(os.path.getctime(mailfn))
         info['size'] = os.path.getsize(mailfn)
+        info['to'] = ""
+        info['subject'] = ""
 
         with open(mailfn, "r") as f:
             mail = f.readlines()
@@ -173,6 +175,8 @@ class MailQueue:
                 if l.startswith("To:"):
                     info['to'] = l[3:].strip()
                     break
+                if l.startswith("Cc:"):
+                    info['to'] = l[3:].strip()
 
         return info