I have very small flask app which send emails using flask-mail but when I run it nothing happen no errors no exceptions nothing!
this is the code
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()
Update
after very long time i got this error
TimeoutError: [Errno 110] Connection timed out