-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmail.py
37 lines (26 loc) · 860 Bytes
/
mail.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import logging
from string import Template
from google.appengine.api import mail
from google.appengine.ext import webapp
from google.appengine.ext.webapp import util
from config import DOMAIN
from config import MAIL_SENDER
# GAE developer doc: https://developers.google.com/appengine/docs/python/mail/
INVITATION_TEMPLATE = """
You have been invited to News Control.
$link
Best regards,
The News Control team
"""
def send_invite_email(email, token):
""" <email> has been invited to News Control """
body = Template(INVITATION_TEMPLATE).substitute({
'email': email,
'link': 'http://' + DOMAIN + '/signup?token=%s' % token
})
subject="News Control Invite"
logging.info(body)
mail.send_mail(sender=MAIL_SENDER,
to=email,
subject=subject,
body=body)