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__)
- mail=Mail(app)
- app.config.update(
- DEBUG=True,
- #EMAIL SETTINGS
- MAIL_SERVER='smtp.gmail.com',
- MAIL_PORT=465,
- MAIL_USE_SSL=True,
- MAIL_USERNAME = '(myemailaccount),
- MAIL_PASSWORD = '(mypassword)'
- )
- mail=Mail(app)
- @app.route("/")
- def index():
- msg = Message(
- 'Hello',
- sender='(myemailaccount)',
- recipients=
- ['(myemailaccount('])
- msg.body = "This is the email body"
- mail.send(msg)
- return "Sent"
- if __name__ == "__main__":
- app.run()
Add Comment
Please, Sign In to add comment