diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2014-05-13 19:09:10 +0200 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2014-05-13 19:09:10 +0200 |
commit | 559f14ed074a6d3f52f1acf62c4c74b0ff0c257e (patch) | |
tree | 189ed58a259f4c65dd5d13e98daf058dbff9e1d1 /pyaggr3g470r/emails.py | |
parent | Updated translations. (diff) | |
download | newspipe-559f14ed074a6d3f52f1acf62c4c74b0ff0c257e.tar.gz newspipe-559f14ed074a6d3f52f1acf62c4c74b0ff0c257e.tar.bz2 newspipe-559f14ed074a6d3f52f1acf62c4c74b0ff0c257e.zip |
Integration of mailgun.
Diffstat (limited to 'pyaggr3g470r/emails.py')
-rw-r--r-- | pyaggr3g470r/emails.py | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/pyaggr3g470r/emails.py b/pyaggr3g470r/emails.py index 65f89de3..5cd10464 100644 --- a/pyaggr3g470r/emails.py +++ b/pyaggr3g470r/emails.py @@ -5,6 +5,8 @@ import smtplib from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText +import requests + import log import utils import conf @@ -63,8 +65,22 @@ def send_email(mfrom, mto, feed, article): # # Notifications # -def new_account_notification(user, password): - pass +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 def new_article_notification(user, feed, article): |