Advertisement
Guest User

Untitled

a guest
Jan 8th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. from flask import Flask
  2. from flask_mail import Mail, Message
  3.  
  4. app = Flask(__name__)
  5.  
  6. DEBUG = True
  7. MAIL_SERVER = 'smtp.gmail.com'
  8. MAIL_PORT = 465
  9. MAIL_USE_TLS = False
  10. MAIL_USE_SSL = True
  11. MAIL_DEBUG = True
  12. MAIL_USERNAME = "myemail@gmail.com"
  13. MAIL_PASSWORD = "mypassword"
  14.  
  15. app.config.from_object(__name__)
  16.  
  17. mail = Mail(app)
  18.  
  19. @app.route("/")
  20. def send_mail():
  21. msg = Message("Hello",
  22. sender=myemail@gmail.com",
  23. recipients=["another_email@gmail.com"],
  24. body="just testing",
  25. )
  26. mail.send(msg)
  27. return "Message sent"
  28. if __name__ == '__main__':
  29. app.run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement