aboutsummaryrefslogtreecommitdiffstats
path: root/news2mail.py
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@cepl.eu>2014-12-31 01:29:28 +0100
committerMatěj Cepl <mcepl@cepl.eu>2014-12-31 01:29:28 +0100
commitcdd9f1d6a872fbc20e368fc23ddaf98eb1ef3741 (patch)
tree0079a7ba384c8147b9ad8df7a1bb7dc84168e29e /news2mail.py
parentb51ede52742e2b94c77b83959cda081bad9675dd (diff)
downloadpyg-cdd9f1d6a872fbc20e368fc23ddaf98eb1ef3741.tar.gz
Make --verbose work.
mail2news produce verbose chatter with -v Fixes #13 Also cleanup.
Diffstat (limited to 'news2mail.py')
-rw-r--r--news2mail.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/news2mail.py b/news2mail.py
index b396bc2..7338fd8 100644
--- a/news2mail.py
+++ b/news2mail.py
@@ -36,7 +36,7 @@ from mail2news import VERSION, DESC
class news2mail(object):
"""news to mail gateway class"""
- def __init__(self):
+ def __init__(self, verbose=False):
self.wlfile = None
self.logfile = None
@@ -50,11 +50,10 @@ class news2mail(object):
self.heads_dict = {}
self.article, self.headers, self.body = [], [], []
- self.message = None
-
- def readfile(self):
self.message = email.message_from_file(sys.stdin)
+ self.verbose = verbose
+
def addheads(self):
"""add new header like X-Gateway: Received:
"""
@@ -154,6 +153,7 @@ class news2mail(object):
def sendarticle(self):
"""Talk to SMTP server and try to send email."""
s = smtplib.SMTP(self.smtpserver)
+ s.set_debuglevel(self.verbose)
s.sendmail(self.envelope, self.rcpt, self.message.as_string())