diff options
author | Cédric Bonhomme <kimble.mandel@gmail.com> | 2013-01-22 21:50:53 +0100 |
---|---|---|
committer | Cédric Bonhomme <kimble.mandel@gmail.com> | 2013-01-22 21:50:53 +0100 |
commit | 1ff297bbd661cc86eddf7547cecf6975745ff906 (patch) | |
tree | df93a95dc99ab0b57c0b27970e1fd8a83b397d6c | |
parent | catch the potential exceptions when sending e-mail via smtp. (diff) | |
download | newspipe-1ff297bbd661cc86eddf7547cecf6975745ff906.tar.gz newspipe-1ff297bbd661cc86eddf7547cecf6975745ff906.tar.bz2 newspipe-1ff297bbd661cc86eddf7547cecf6975745ff906.zip |
improvement of send_mail() function.
-rwxr-xr-x | source/utils.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/source/utils.py b/source/utils.py index 577304db..24d6c538 100755 --- a/source/utils.py +++ b/source/utils.py @@ -171,13 +171,13 @@ def send_mail(mfrom, mto, feed_title, article_title, description): try: s = smtplib.SMTP(conf.smtp_server) s.login(conf.username, conf.password) + except Exception as e: + print(e) + else: # sendmail function takes 3 arguments: sender's address, recipient's address # and message to send - here it is sent as one string. s.sendmail(mfrom, mto, msg.as_string()) s.quit() - except Exception as e: - print(e) - return def add_feed(feed_url): """ |