Guest User

Untitled

a guest
Jun 23rd, 2018
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. from flask import Flask
  2. from flask_mail import Mail, Message
  3.  
  4. app =Flask(__name__)
  5. mail=Mail(app)
  6.  
  7. app.config.update(
  8. DEBUG=True,
  9. #EMAIL SETTINGS
  10. MAIL_SERVER='smtp.gmail.com',
  11. MAIL_PORT=465,
  12. MAIL_USE_SSL=True,
  13. MAIL_USERNAME = '(myemailaccount),
  14. MAIL_PASSWORD = '(mypassword)'
  15. )
  16.  
  17. mail=Mail(app)
  18.  
  19. @app.route("/")
  20. def index():
  21. msg = Message(
  22. 'Hello',
  23. sender='(myemailaccount)',
  24. recipients=
  25. ['(myemailaccount('])
  26. msg.body = "This is the email body"
  27. mail.send(msg)
  28. return "Sent"
  29.  
  30. if __name__ == "__main__":
  31. app.run()
Add Comment
Please, Sign In to add comment