Monitoring number of smtp bytes sent through python e-mail socket

Gabriel Genellina gagsl-py at yahoo.com.ar
Mon Dec 4 21:04:52 EST 2006


At Monday 4/12/2006 22:18, William Connery wrote:

>I want to give users an indication of the percentage of the e-mail that
>has already been sent so as to avoid frustration when dealing with large
>attachments or a slow smtp server. But the smtplib module doesn't seem
>to provide access to the number of bytes that have already been sent.

You should subclass from smtplib.HTML and override the send() method. 
Internally, it uses socket.sendall; replace it with discrete calls to 
socket.send where you can update the progress.
As send() is used by many commands, you may wish to enable that 
behavior only inside the data() call.


-- 
Gabriel Genellina
Softlab SRL 

__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis! 
¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar



More information about the Python-list mailing list