aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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