소스 검색

emails can have no recepient, apearentlly

Noah Vogt 3 년 전
부모
커밋
9b9d41271c
1개의 변경된 파일9개의 추가작업 그리고 2개의 파일을 삭제
  1. 9 2
      app/src/main/python/mailFunctions.py

+ 9 - 2
app/src/main/python/mailFunctions.py

@@ -59,9 +59,16 @@ def fetchMails(connection, inbox):
         #print(msg)
 
         raw_string = email.header.decode_header(msg['Subject'])[0]
-        raw_from = email.header.decode_header(msg['From'])[0]
-        raw_to = email.header.decode_header(msg['To'])[0]
+        print("raw_string: " + str(raw_string))
+        raw_from = email.header.decode_header(msg['From'])
+        print("raw_from" + str(raw_from))
+        try:
+            raw_to = email.header.decode_header(msg['To'])
+        except TypeError:
+            raw_to = [("", None)]
+        print("raw_to" + str(raw_to))
         raw_date = email.header.decode_header(msg['Date'])[0]
+        print("raw_to" + str(raw_date))
 
         raw_msg = str(msg)