need help

Cameron Simpson cs at cskk.id.au
Sun Oct 23 19:02:10 EDT 2022


Please try to choose more descriptive subject lines (eg "problem with 
sock.connect" or similar). That you want help is almost implicit, and 
what the whole list is for.

Anyway, to your problem:

On 23Oct2022 10:19, Shuaib Akhtar <i9shuaib1 at gmail.com> wrote:
>   How to fix Traceback (most recent call last):
>     File "C:\Program
>   Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2288.0_x64__qbz5n2kfra8p0\lib\socket.py",
>   line 833, in create_connection
>       sock.connect(sa)
>   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

This usually means that either the host address is legal but incorrect 
(there's no host/server listening with that address) or that the port is 
incorrect and some firewall is _discarding_ your traffic because of the 
wrong port instead of returning a nice "connection refused", which is 
usually instant.

Fortunately you've listed your call:

>     File "C:\Users\i9shu\Downloads\python email bot\email bot.py", 
>   line 25,
>   in <module>
>       server = smtplib.SMTP('smtp.gmail.com',2525)

So, I'll try that by hand here:

     % telnet smtp.gmail.com 2525
     Trying 142.250.4.108...
     telnet: connect to address 142.250.4.108: Operation timed out
     Trying 2404:6800:4003:c0f::6d...
     telnet: connect to address 2404:6800:4003:c0f::6d: No route to host
     telnet: Unable to connect to remote host
     %

I'd say GMail are rudely dropping traffic to port 2525. Maybe try just 
25, the normal SMTP port?

Cheers,
Cameron Simpson <cs at cskk.id.au>


More information about the Python-list mailing list