aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bonhomme <kimble.mandel@gmail.com>2013-01-22 21:11:00 +0100
committerCédric Bonhomme <kimble.mandel@gmail.com>2013-01-22 21:11:00 +0100
commit16a3ba69520bfb4d57c4ac0d3c16cc6521058e41 (patch)
tree8bc498c357344ca96afb5d32c016ffc1ce69eee5
parentRemoved -tt option from python command line. (diff)
downloadnewspipe-16a3ba69520bfb4d57c4ac0d3c16cc6521058e41.tar.gz
newspipe-16a3ba69520bfb4d57c4ac0d3c16cc6521058e41.tar.bz2
newspipe-16a3ba69520bfb4d57c4ac0d3c16cc6521058e41.zip
catch the potential exceptions when sending e-mail via smtp.
-rwxr-xr-xsource/utils.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/source/utils.py b/source/utils.py
index f2756286..577304db 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:
- print("smtp error")
+ # 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
- # 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()
def add_feed(feed_url):
"""
bgstack15