summaryrefslogtreecommitdiff
path: root/alot/db/message.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2018-08-06 11:16:20 -0700
committerPatrick Totzke <patricktotzke@gmail.com>2018-08-06 20:04:09 +0100
commitcd032bca1c4b062e2ef660e77d438a15d58e891e (patch)
tree7124edc56fcbb5fab256d71e1f6b6c131df4afa0 /alot/db/message.py
parentec3e9eab40153efc7d59a779a4073f303d377a9d (diff)
Set the policy for email.message_from_*
Otherwise they default to the Compat32 policy, which isn't want we want, since we end up with a mixture of new and old types. Fixes: #1292
Diffstat (limited to 'alot/db/message.py')
-rw-r--r--alot/db/message.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/alot/db/message.py b/alot/db/message.py
index b53ec6c0..3c860cac 100644
--- a/alot/db/message.py
+++ b/alot/db/message.py
@@ -3,6 +3,7 @@
# For further details see the COPYING file
import email
import email.charset as charset
+import email.policy
import functools
from datetime import datetime
@@ -103,7 +104,8 @@ class Message(object):
with open(path, 'rb') as f:
self._email = utils.decrypted_message_from_bytes(f.read())
except IOError:
- self._email = email.message_from_string(warning)
+ self._email = email.message_from_string(
+ warning, policy=email.policy.SMTP)
return self._email
def get_date(self):