From bf1346c6e25fa9060f84d8775b43f359e2ef0908 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Tue, 13 May 2014 19:18:09 +0200 Subject: display the error. --- pyaggr3g470r/emails.py | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) (limited to 'pyaggr3g470r/emails.py') 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 = """\n\n[pyAggr3g470r] Account activation\n\n\nYour account has been created. Clink on the following to confirm it:%s\n\n""" % \ - (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 = """\n\n[pyAggr3g470r] Account activation\n\n\nYour account has been created. Clink on the following to confirm it:%s\n\n""" % \ + (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): -- cgit