smtplib upload progress

G

Guyon Morée

Hi,

I wanted to use smtplib to send a bunch of files. All good, except I
cant monitor the upload progress as far as I can see.

So I monkey patched the SMTP.sendall method, which chops up the data
and keeps calling a provided callback for every chunk of data sent.

This feels kind of dirty and I was wondering what my other options are
to tackle this seemingly simple problem.

thanx,

Guyon Moree
 
G

Gabriel Genellina

I wanted to use smtplib to send a bunch of files. All good, except I
cant monitor the upload progress as far as I can see.

So I monkey patched the SMTP.sendall method, which chops up the data
and keeps calling a provided callback for every chunk of data sent.

This feels kind of dirty and I was wondering what my other options are
to tackle this seemingly simple problem.

(there is no sendall method in SMTP, but send)
Looks like there is no other way... perhaps I'd have overriden data()
instead of send(), but it's as dirty as yours, one has to duplicate the
original code.
I don't know how often the need arises or how useful would this be to
others, but you could submit a patch to http://bugs.python.org/
 
D

Dennis Lee Bieber

(there is no sendall method in SMTP, but send)
Looks like there is no other way... perhaps I'd have overriden data()
instead of send(), but it's as dirty as yours, one has to duplicate the
original code.
I don't know how often the need arises or how useful would this be to
others, but you could submit a patch to http://bugs.python.org/
I'd suspect not very often given the original store&forward scheme
of SMTP... Especially when mail clients used to just spool a message
file for a background daemon to attempt to periodically send... On such
a system, the client "send" is practically instantaneous, and the real
message send may take a few days to complete if the daemon can't get a
valid connection for the destination address.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top