Forums

Network unreachable when sending E-Mail from Hotmail

2023-11-02 12:55:15,454: Exception on /login/reset [GET] Traceback (most recent call last): File "/home/Widebody/.local/lib/python3.10/site-packages/flask/app.py", line 2447, in wsgi_app response = self.full_dispatch_request() File "/home/Widebody/.local/lib/python3.10/site-packages/flask/app.py", line 1952, in full_dispatch_request rv = self.handle_user_exception(e) File "/home/Widebody/.local/lib/python3.10/site-packages/flask/app.py", line 1821, in handle_user_exception reraise(exc_type, exc_value, tb) File "/home/Widebody/.local/lib/python3.10/site-packages/flask/_compat.py", line 39, in reraise raise value File "/home/Widebody/.local/lib/python3.10/site-packages/flask/app.py", line 1950, in full_dispatch_request rv = self.dispatch_request() File "/home/Widebody/.local/lib/python3.10/site-packages/flask/app.py", line 1936, in dispatch_request return self.view_functionsrule.endpoint File "/home/Widebody/mysite/index.py", line 1659, in login_reset mail_sender.send_pwd_reset_mail(reset_email, username, reset_url) File "/home/Widebody/mysite/index.py", line 244, in send_pwd_reset_mail mail.send(message) File "/home/Widebody/.local/lib/python3.10/site-packages/flask_mail.py", line 491, in send with self.connect() as connection: File "/home/Widebody/.local/lib/python3.10/site-packages/flask_mail.py", line 144, in enter self.host = self.configure_host() File "/home/Widebody/.local/lib/python3.10/site-packages/flask_mail.py", line 158, in configure_host host = smtplib.SMTP(self.mail.server, self.mail.port) File "/usr/local/lib/python3.10/smtplib.py", line 255, in init (code, msg) = self.connect(host, port) File "/usr/local/lib/python3.10/smtplib.py", line 341, in connect self.sock = self._get_socket(host, port, self.timeout) File "/usr/local/lib/python3.10/smtplib.py", line 312, in _get_socket return socket.create_connection((host, port), timeout, File "/usr/local/lib/python3.10/socket.py", line 845, in create_connection raise err File "/usr/local/lib/python3.10/socket.py", line 833, in create_connection sock.connect(sa) OSError: [Errno 101] Network is unreachable

I get an error when using Flask-Mail to send an email with my hotmail account. The SMTP Server is smtp.office365.com and the port is 587.

Thanks in advice.

See https://help.pythonanywhere.com/pages/SMTPForFreeUsers/