aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r/emails.py
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2014-05-13 19:18:09 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2014-05-13 19:18:09 +0200
commitbf1346c6e25fa9060f84d8775b43f359e2ef0908 (patch)
tree0550d9bbf317502d7525a15f7985acf3146e6604 /pyaggr3g470r/emails.py
parentAdded missing import. (diff)
downloadnewspipe-bf1346c6e25fa9060f84d8775b43f359e2ef0908.tar.gz
newspipe-bf1346c6e25fa9060f84d8775b43f359e2ef0908.tar.bz2
newspipe-bf1346c6e25fa9060f84d8775b43f359e2ef0908.zip
display the error.
Diffstat (limited to 'pyaggr3g470r/emails.py')
-rw-r--r--pyaggr3g470r/emails.py34
1 files changed, 19 insertions, 15 deletions
diff --git a/pyaggr3g470r/emails.py b/pyaggr3g470r/emails.py
index 5cd10464..85dabf86 100644
--- a/pyaggr3g470r/emails.py
+++ b/pyaggr3g470r/emails.py
@@ -66,21 +66,25 @@ def send_email(mfrom, mto, feed, article):
# Notifications
#
def new_account_notification(user):
- html = """<html>\n<head>\n<title>[pyAggr3g470r] Account activation</title>\n</head>\n<body>\nYour account has been created. Clink on the following to confirm it:%s\n</body>\n</html>""" % \
- (conf.PLATFORM_URL + 'confirm_account/' + user.activation_key)
- plaintext = utils.clear_string(html)
-
- r = requests.post("https://api.mailgun.net/v2/%s/messages" % conf.MAILGUN_DOMAIN,
- auth=("api", conf.MAILGUN_KEY),
- data={
- "from": conf.ADMIN_EMAIL,
- "to": user.email,
- "subject": subject,
- "text": plaintext,
- "html": html
- }
- )
- return r
+ try:
+ html = """<html>\n<head>\n<title>[pyAggr3g470r] Account activation</title>\n</head>\n<body>\nYour account has been created. Clink on the following to confirm it:%s\n</body>\n</html>""" % \
+ (conf.PLATFORM_URL + 'confirm_account/' + user.activation_key)
+ plaintext = utils.clear_string(html)
+
+ r = requests.post("https://api.mailgun.net/v2/%s/messages" % conf.MAILGUN_DOMAIN,
+ auth=("api", conf.MAILGUN_KEY),
+ data={
+ "from": conf.ADMIN_EMAIL,
+ "to": user.email,
+ "subject": subject,
+ "text": plaintext,
+ "html": html
+ }
+ )
+ return r
+ except Exception as e:
+ print str(e)
+
def new_article_notification(user, feed, article):
bgstack15