diff options
author | Matěj Cepl <mcepl@cepl.eu> | 2023-03-01 11:35:54 +0100 |
---|---|---|
committer | Matěj Cepl <mcepl@cepl.eu> | 2023-05-25 10:56:30 +0200 |
commit | 458dd9bdb4a0346b09112659af66b560cefa1d98 (patch) | |
tree | 7d221497dba5bb649390a4db06aa217f6cf8fa37 /mail2news.py | |
parent | d79cdd057a1e7dc44a5196905e897ee0f100f9d1 (diff) | |
download | pyg-458dd9bdb4a0346b09112659af66b560cefa1d98.tar.gz |
Use email.policy.SMTP to be perfectly conforming with RFCs.
Perhaps fixes: https://todo.sr.ht/~mcepl/pygn/6
Diffstat (limited to 'mail2news.py')
-rw-r--r-- | mail2news.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mail2news.py b/mail2news.py index 6a7aaff..2f64f6c 100644 --- a/mail2news.py +++ b/mail2news.py @@ -66,14 +66,14 @@ class mail2news(object): msg[header] = value.strip() def __readfile(self, opt): - message = email.message_from_file(sys.stdin, policy=email.policy.default) + message = email.message_from_file(sys.stdin, policy=email.policy.SMTP) if (len(message) == 0) \ and message.get_payload().startswith('/'): msg_file_name = message.get_payload().strip() del message with open(msg_file_name, 'r') as msg_file: - message = email.message_from_file(msg_file, policy=email.policy.default) + message = email.message_from_file(msg_file, policy=email.policy.SMTP) # introduce nntpheads self.__add_header('Newsgroups', opt.newsgroup, message) |