How to set smtplib send timeout in python 2.4?

I am having problems with smtplib linking my program when emailing fails because a timeout never occurs. The server I use does not and will never have python greater than 2.4, so I cannot use the timeout argument for the SMTP constructor in later versions of python.

Python 2.4 reports that the SMTP class does not have a "timeout" argument:

class SMTP([host[, port[, local_hostname]]])

So how do I simulate this functionality?

+3
source share
1 answer
import socket
socket.setdefaulttimeout(120)

2 , - ( , SMTP Python 2.4 ).

: -, OP TLS, , B...:

, 2.6 smtplib 2.4? ... ! -)

...

+6

Source: https://habr.com/ru/post/1715678/


All Articles