diff options
Diffstat (limited to 'pygm2n')
-rwxr-xr-x | pygm2n | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -16,6 +16,7 @@ Gets news article and sends it via SMTP. from __future__ import print_function import sys +import nntplib import argparse @@ -40,7 +41,8 @@ def parse_cmdline(): parser.add_argument('-p', '--password', default='', help='password (for auth to newsserver)') parser.add_argument('-P', '--port', default='') - parser.add_argument('-M', '--reader', default='') + # WHAT IS THIS GOOD FOR? + # parser.add_argument('-M', '--reader', action='store_true') parser.add_argument('-e', '--envellope', default='') parser.add_argument('-t', '--to', dest='rcpt') @@ -110,12 +112,13 @@ try: open smtp connection and send e-mail """ - if len(m2n.headers) > 0 and len(m2n.body) > 0: + if len(m2n.headers) > 0 and len(m2n.message.get_payload()) > 0: # wl.logmsg(m2n.heads_dict,wl.ACCEPT,owner) if not opt.test: - resp = m2n.sendemail() - if resp: - print(resp) + try: + resp = m2n.sendemail() + except nntplib.NNTPError, message: + print(message) except KeyboardInterrupt: print('Keyboard Interrupt') |