Send With Confidence
Partner with the email service trusted by developers and marketers for time-savings, scalability, and delivery expertise.
Time to read: 12 minutes
Partner with the email service trusted by developers and marketers for time-savings, scalability, and delivery expertise.
$ mkdir flask-receive-emails | |
$ cd flask-receive-emails | |
$ python3 -m venv venv | |
$ source venv/bin/activate | |
(venv) $ pip install flask |
$ md flask-receive-emails | |
$ cd flask-receive-emails | |
$ python -m venv venv | |
$ venv\Scripts\activate | |
(venv) $ pip install flask |
from flask import Flask, request | |
app = Flask(__name__) | |
@app.route('/email', methods=['POST']) | |
def receive_email(): | |
print('From:', request.form['from']) | |
print('To:', request.form['to']) | |
print('Subject:', request.form['subject']) | |
print('Body:', request.form['text']) | |
return '' |
(venv) $ flask run | |
* Environment: production | |
WARNING: This is a development server. Do not use it in a production deployment. | |
Use a production WSGI server instead. | |
* Debug mode: off | |
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit) |
$ ngrok http 5000 |