Browse Source

Handle decoding error

Phyks (Lucas Verney) 5 years ago
parent
commit
25b8db512f
1 changed files with 4 additions and 1 deletions
  1. 4
    1
      emails_sms_free.py

+ 4
- 1
emails_sms_free.py View File

@@ -17,7 +17,10 @@ def get_subject(subject_header):
17 17
     if tmp[1] is None:
18 18
         return str(tmp[0])
19 19
     else:
20
-        return tmp[0].decode(tmp[1])
20
+        try:
21
+            return tmp[0].decode(tmp[1])
22
+        except LookupError:
23
+            return "--Unable to fetch subject--"
21 24
 
22 25
 
23 26
 def send(url, user, password, msg, i=0):