-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontact.py
27 lines (23 loc) · 976 Bytes
/
contact.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
from google.appengine.api import mail
import json
import webapp2
class SendEmail(webapp2.RequestHandler):
def post(self):
to = self.request.get("to")
user_name = self.request.get("name")
user_address = self.request.get("email")
subject = self.request.get("subject")
body = self.request.get("message")
behalf_of = user_name + " <" + user_address +">"
sender_address ="CB Contact <[email protected]>"
if "<[email protected]>" not in to:
if "<[email protected]>" not in to:
return
mail.send_mail(sender= sender_address,
to = to,
#cc = behalf_of,
reply_to = behalf_of,
subject = subject+" | "+user_name+" | "+user_address,
body = body,
headers = {"On-Behalf-Of":behalf_of})
self.response.out.write(json.dumps({"done":"true"}))