diff options
Diffstat (limited to 'alot')
-rw-r--r-- | alot/commands/globals.py | 4 | ||||
-rw-r--r-- | alot/message.py | 10 |
2 files changed, 7 insertions, 7 deletions
diff --git a/alot/commands/globals.py b/alot/commands/globals.py index 43441763..3536df29 100644 --- a/alot/commands/globals.py +++ b/alot/commands/globals.py @@ -566,10 +566,6 @@ class ComposeCommand(Command): return self.envelope.add('Subject', subject) - # get missing Message-ID header - if 'Message-ID' not in self.envelope.headers: - self.envelope.add('Message-ID', email.Utils.make_msgid()) - if self.attach: for a in self.attach: self.envelope.attach(a) diff --git a/alot/message.py b/alot/message.py index bd23cf3c..2aa9381a 100644 --- a/alot/message.py +++ b/alot/message.py @@ -540,11 +540,15 @@ class Envelope(object): else: msg = textpart - # add Date header - msg['Date'] = email.Utils.formatdate() + headers = self.headers.copy() + # add Date and Message-ID headers + if 'Date' not in headers: + headers['Date'] = [email.Utils.formatdate()] + if 'Message-ID' not in headers: + headers['Message-ID'] = [email.Utils.make_msgid()] # copy headers from envelope to mail - for k, vlist in self.headers.items(): + for k, vlist in headers.items(): for v in vlist: msg[k] = encode_header(k, v) |