diff options
author | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2020-11-30 17:59:23 -0500 |
---|---|---|
committer | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2020-11-30 17:59:23 -0500 |
commit | 45c63bd0fd80fb59ef5b75a305890338c507d3fa (patch) | |
tree | 74fd1dcf8312aa91f39bac1d4d0a8ccfe2c19a3d /b4/ty.py | |
parent | 97ed3503d7493cd3f9a9bfaa7adf5db885f94e63 (diff) | |
download | b4-45c63bd0fd80fb59ef5b75a305890338c507d3fa.tar.gz |
Fix headers generated by "b4 ty"
Make sure we always create a Date: header, and that we're not crashing
when we try to parse a message without a Date: header.
Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Diffstat (limited to 'b4/ty.py')
-rw-r--r-- | b4/ty.py | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -92,7 +92,8 @@ def make_reply(reply_template, jsondata): allto.append((jsondata['fromname'], jsondata['fromemail'])) msg['To'] = b4.format_addrs(allto) - msg['Cc'] = b4.format_addrs(allcc) + if allcc: + msg['Cc'] = b4.format_addrs(allcc) msg['In-Reply-To'] = '<%s>' % jsondata['msgid'] if len(jsondata['references']): msg['References'] = '%s <%s>' % (jsondata['references'], jsondata['msgid']) @@ -107,6 +108,7 @@ def make_reply(reply_template, jsondata): mydomain = jsondata['myemail'].split('@')[1] msg['Message-Id'] = email.utils.make_msgid(idstring='b4-ty', domain=mydomain) + msg['Date'] = email.utils.formatdate(localtime=True) return msg |