From 8e8a89e3dc6d6da2e9f230e316f4c3372013bb85 Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Sun, 28 Dec 2014 01:00:36 +0100 Subject: Work directly on self.message in mail2news. --- pygm2n | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'pygm2n') diff --git a/pygm2n b/pygm2n index 9c4e069..81561be 100755 --- a/pygm2n +++ b/pygm2n @@ -95,9 +95,7 @@ try: format rfc 822 headers from input article """ - m2n.mergeheads() # make unique dict from NNTP and SMTP dicts - - m2n.heads_dict['X-Gateway'] = 'pyg {0} {1}'.format( + m2n.message['X-Gateway'] = 'pyg {0} {1}'.format( mail2news.VERSION, mail2news.DESC) m2n.renameheads() # rename useless heads m2n.removeheads() # remove other heads @@ -105,8 +103,7 @@ try: m2n.sortheads() # sort remaining heads :) if opt.verbose: - for line in m2n.headers: - print(line) + print(m2n.message.as_string()) """phase 4: open smtp connection and send e-mail @@ -117,8 +114,8 @@ try: if not opt.test: try: resp = m2n.sendemail() - except nntplib.NNTPError, message: - print(message) + except nntplib.NNTPError as ex: + print(ex) except KeyboardInterrupt: print('Keyboard Interrupt') -- cgit