Threaded alternatives to smtplib?

Alex Jurkiewicz alex at bluebottle.net.au
Mon May 4 01:46:06 EDT 2009


Hi all,
I'm writing a Python script to do a "mail merge" style email 
distribution. I create a few python threads and in each one I call 
`smtpserver = smtplib.SMTP(our.smtpserver.com)`. However, during the 
sending process, there seems to be only one connection open to our mail 
server at any one time. In other words, all these threads gain me no 
speed benefit at all!

I seem to be running into the issue where smtplib is not fully 
thread-safe, as mentioned in this thread:
http://mail.python.org/pipermail/python-list/2007-March/429067.html
http://mail.python.org/pipermail/python-list/2007-March/429172.html

Does anyone have suggestions as to a suitable workaround for this issue? 
I was looking at the Twisted library, which seems possible but 
significantly more complex.


Thanks,
Alex Jurkiewicz



More information about the Python-list mailing list