0
votes

from flask import Flask
from flask_mail import Mail, Message
import os

app = Flask(__name__)

mail_settings = {
    "MAIL_SERVER": 'mail.hi.in',
    "MAIL_PORT": 465,
    "MAIL_USE_TLS": False,
    "MAIL_USE_SSL": True,
    "MAIL_USERNAME": abcde,
    "MAIL_PASSWORD": password
}

app.config.update(mail_settings)
mail = Mail(app)


if __name__ == '__main__':
    with app.app_context():
        msg = Message(subject="Hello",
                      sender=app.config.get("[email protected]"),
                      recipients=["[email protected]"],
                      body="This is a test email I sent with Gmail and Python!")
        mail.send(msg)


Error Saying: TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

1
Is a SMTP server installed in 'mail.hi.in', listening on port 465? - Serge Ballesta

1 Answers

-1
votes

This is a test email I sent with Gmail and Python! I see that you use Gmail, so if you don't have enabled "Less secure apps on your google account" go here