summaryrefslogtreecommitdiff
path: root/alot
diff options
context:
space:
mode:
authorpacien <pacien.trangirard@pacien.net>2019-11-23 21:36:26 +0100
committerPatrick Totzke <patricktotzke@gmail.com>2019-11-23 22:07:07 +0000
commit4a590b9d4a62147f83a4ce1011e3c40337de156a (patch)
tree2269b7728ae257a28d3ce1ddfead665d29201023 /alot
parent59227e42199066ee5759abf681aff468ed05a4c8 (diff)
envelope: do not add another Date header if one is already present
Fixes https://github.com/pazz/alot/issues/1435: Do not add a Date header if it is already present
Diffstat (limited to 'alot')
-rw-r--r--alot/commands/envelope.py3
-rw-r--r--alot/db/envelope.py5
2 files changed, 5 insertions, 3 deletions
diff --git a/alot/commands/envelope.py b/alot/commands/envelope.py
index 60a9c1f4..17d32f89 100644
--- a/alot/commands/envelope.py
+++ b/alot/commands/envelope.py
@@ -131,8 +131,6 @@ class SaveCommand(Command):
mail = envelope.construct_mail()
# store mail locally
- # add Date header
- mail['Date'] = email.utils.formatdate(localtime=True)
path = account.store_draft_mail(
mail.as_string(policy=email.policy.SMTP))
@@ -242,7 +240,6 @@ class SendCommand(Command):
try:
self.mail = self.envelope.construct_mail()
- self.mail['Date'] = email.utils.formatdate(localtime=True)
self.mail = self.mail.as_string(policy=email.policy.SMTP)
except GPGProblem as e:
ui.clear_notify([clearme])
diff --git a/alot/db/envelope.py b/alot/db/envelope.py
index 7e08289c..1e5de309 100644
--- a/alot/db/envelope.py
+++ b/alot/db/envelope.py
@@ -272,6 +272,11 @@ class Envelope:
outer_msg = unencrypted_msg
headers = self.headers.copy()
+
+ # add Date header
+ if 'Date' not in headers:
+ headers['Date'] = [email.utils.formatdate(localtime=True)]
+
# add Message-ID
if 'Message-ID' not in headers:
headers['Message-ID'] = [email.utils.make_msgid()]