aboutsummaryrefslogtreecommitdiffstats
path: root/pygm2n
diff options
context:
space:
mode:
Diffstat (limited to 'pygm2n')
-rwxr-xr-xpygm2n13
1 files changed, 8 insertions, 5 deletions
diff --git a/pygm2n b/pygm2n
index 2dcd21e..9c4e069 100755
--- a/pygm2n
+++ b/pygm2n
@@ -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')