aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bonhomme <kimble.mandel@gmail.com>2013-01-22 21:50:53 +0100
committerCédric Bonhomme <kimble.mandel@gmail.com>2013-01-22 21:50:53 +0100
commit1ff297bbd661cc86eddf7547cecf6975745ff906 (patch)
treedf93a95dc99ab0b57c0b27970e1fd8a83b397d6c
parentcatch the potential exceptions when sending e-mail via smtp. (diff)
downloadnewspipe-1ff297bbd661cc86eddf7547cecf6975745ff906.tar.gz
newspipe-1ff297bbd661cc86eddf7547cecf6975745ff906.tar.bz2
newspipe-1ff297bbd661cc86eddf7547cecf6975745ff906.zip
improvement of send_mail() function.
-rwxr-xr-xsource/utils.py6
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):
"""
bgstack15