|
|
@ -114,7 +114,12 @@ for email_file in file_list:
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
textbody = part.get_payload(decode=True).decode(get_charset(part))
|
|
|
|
textbody = part.get_payload(decode=True).decode(get_charset(part))
|
|
|
|
except UnicodeDecodeError:
|
|
|
|
except UnicodeDecodeError:
|
|
|
|
|
|
|
|
# This part is probably in windows-1252 encoding
|
|
|
|
|
|
|
|
try:
|
|
|
|
textbody = part.get_payload(decode=True).decode('windows-1252')
|
|
|
|
textbody = part.get_payload(decode=True).decode('windows-1252')
|
|
|
|
|
|
|
|
except UnicodeDecodeError:
|
|
|
|
|
|
|
|
# Ok, we really have no clue how to decode this, we'll just skip it...
|
|
|
|
|
|
|
|
continue
|
|
|
|
except LookupError:
|
|
|
|
except LookupError:
|
|
|
|
pass
|
|
|
|
pass
|
|
|
|
elif part.get_content_type() == "text/html" or part.get_content_type == "text/xhtml+xml" or part.get_content_type == "application/xhtml+xml":
|
|
|
|
elif part.get_content_type() == "text/html" or part.get_content_type == "text/xhtml+xml" or part.get_content_type == "application/xhtml+xml":
|
|
|
@ -122,7 +127,12 @@ for email_file in file_list:
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
htmlbody = part.get_payload(decode=True).decode(get_charset(part))
|
|
|
|
htmlbody = part.get_payload(decode=True).decode(get_charset(part))
|
|
|
|
except UnicodeDecodeError:
|
|
|
|
except UnicodeDecodeError:
|
|
|
|
|
|
|
|
# This part is probably in windows-1252 encoding
|
|
|
|
|
|
|
|
try:
|
|
|
|
htmlbody = part.get_payload(decode=True).decode('windows-1252')
|
|
|
|
htmlbody = part.get_payload(decode=True).decode('windows-1252')
|
|
|
|
|
|
|
|
except UnicodeDecodeError:
|
|
|
|
|
|
|
|
# Ok, we really have no clue how to decode this, we'll just skip it...
|
|
|
|
|
|
|
|
continue
|
|
|
|
except LookupError:
|
|
|
|
except LookupError:
|
|
|
|
pass
|
|
|
|
pass
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|