From cca6bdb9970651d44cdc360c89c6d24443520d58 Mon Sep 17 00:00:00 2001 From: cedricbonhomme Date: Tue, 23 Mar 2010 14:55:55 +0100 Subject: Minor improvements for the e-mail notification. --- cfg/pyAggr3g470r.cfg | 6 ++++-- feedgetter.py | 2 +- utils.py | 7 +++++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/cfg/pyAggr3g470r.cfg b/cfg/pyAggr3g470r.cfg index 73e4d25f..419967d8 100755 --- a/cfg/pyAggr3g470r.cfg +++ b/cfg/pyAggr3g470r.cfg @@ -3,5 +3,7 @@ path = /home/cedric/prog/python/projects/pyaggr3g470r/ sqlitebase = ./var/feed.db [mail] mail_from = pyAggr3g470r@mail.com -mail_to = example@mail.com -smtp = smtp.orange.fr \ No newline at end of file +mail_to = address_of_the_recipient@example.com +smtp = smtp.example.com +username = your_mail_address@example.com +password = your_password \ No newline at end of file diff --git a/feedgetter.py b/feedgetter.py index 7e6e4c71..36495b43 100755 --- a/feedgetter.py +++ b/feedgetter.py @@ -127,7 +127,7 @@ class FeedGetter(object): if result[0][0] == "1": # send the article utils.send_mail(utils.mail_from, utils.mail_to, \ - a_feed.feed.title.encode('utf-8'), description) + a_feed.feed.title.encode('utf-8'), description) except sqlite3.IntegrityError: # article already in the base pass diff --git a/utils.py b/utils.py index e0011edd..25031317 100755 --- a/utils.py +++ b/utils.py @@ -44,7 +44,9 @@ path = config.get('global','path') sqlite_base = os.path.abspath(config.get('global', 'sqlitebase')) mail_from = config.get('mail','mail_from') mail_to = config.get('mail','mail_to') -mail_smtp = config.get('mail','smtp') +smtp_server = config.get('mail','smtp') +username = config.get('mail','username') +password = config.get('mail','password') def detect_language(text): @@ -137,7 +139,8 @@ def send_mail(mfrom, mto, feed_title, message): mail['Subject'] = '[pyAggr3g470r] News from ' + feed_title #email['Text'] = message - server = smtplib.SMTP(mail_smtp) + server = smtplib.SMTP(smtp_server) + server.login(username, password) server.sendmail(mfrom, \ mto, \ mail.as_string()) -- cgit