Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from flask import Flask
- from flask_mail import Mail, Message
- app = Flask(__name__)
- DEBUG = True
- MAIL_SERVER = 'smtp.gmail.com'
- MAIL_PORT = 465
- MAIL_USE_TLS = False
- MAIL_USE_SSL = True
- MAIL_DEBUG = True
- MAIL_USERNAME = "myemail@gmail.com"
- MAIL_PASSWORD = "mypassword"
- app.config.from_object(__name__)
- mail = Mail(app)
- @app.route("/")
- def send_mail():
- msg = Message("Hello",
- sender=myemail@gmail.com",
- recipients=["another_email@gmail.com"],
- body="just testing",
- )
- mail.send(msg)
- return "Message sent"
- if __name__ == '__main__':
- app.run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement