Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. from flask import Flask, request
  2. from flask.json import jsonify
  3.  
  4. from google.appengine.api import mail
  5.  
  6. app = Flask(__name__)
  7.  
  8. # define API endpoint /send
  9. @app.route('/send', methods=['POST']) #GET requests will be blocked
  10. def send():
  11. req_data = request.get_json()
  12. sender_address = req_data['from']
  13. to = req_data['to']
  14. subject = req_data['subject']
  15. body = req_data['html']
  16. mail.send_mail(sender=sender_address, to=to, subject=subject, body='', html=body)
  17. return 'Email sent.',200
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement