Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from flask import Flask, request
- from flask.json import jsonify
- from google.appengine.api import mail
- app = Flask(__name__)
- # define API endpoint /send
- @app.route('/send', methods=['POST']) #GET requests will be blocked
- def send():
- req_data = request.get_json()
- sender_address = req_data['from']
- to = req_data['to']
- subject = req_data['subject']
- body = req_data['html']
- mail.send_mail(sender=sender_address, to=to, subject=subject, body='', html=body)
- return 'Email sent.',200
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement