Guest User

Untitled

a guest
Feb 17th, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. from flask import Flask
  2. from flask_mail import Mail, Message
  3.  
  4. app = Flask(__name__)
  5.  
  6. app.config.update(
  7. #EMAIL SETTINGS
  8. MAIL_SERVER='smtp.qq.com',
  9. MAIL_PORT=465,
  10. MAIL_USE_SSL=True,
  11. MAIL_USERNAME = 'QQIDHere',
  12. MAIL_PASSWORD = 'QQPasswordHere'
  13. )
  14.  
  15. mail = Mail(app)
  16.  
  17. @app.route("/")
  18. def index():
  19. msg = Message(subject="Hello",
  20. sender='you@qq.com',
  21. recipients=['recipient@recipient_domain.com'])
  22. msg.html = "<b>testing</b> html"
  23.  
  24. mail.send(msg)
  25.  
  26. return '<h1>Sent</h1>'
  27.  
  28. if __name__ == '__main__':
  29. app.run(debug=True)
Add Comment
Please, Sign In to add comment