logging SMTPHandler and Authentication

Vinay Sajip vinay_sajip at yahoo.co.uk
Tue May 1 06:25:59 EDT 2007


On May 1, 1:08 am, james.p.n... at gmail.com wrote:
> I'm new to Python, but I've been thrown into coding a pretty
> complicated regression testing script.  I need to email the log of the
> daily test to the code owners.  I thought I could use SMTPHandler for
> this, but our email system requires authentication.  I have not been
> able to figure out how to log in using SMTPHandler.  I found the
> following post on comp.lang.python:
>
> http://groups.google.com/group/comp.lang.python/browse_frm/thread/ef8...
>
> However, I haven't been able to translate this to anything I can use.
> I've also looked at the source code for the SMTPHandler, but I don't
> want to edit that.
>
> Has anyone else dealt with this?
>
> Thanks much,
> James

I've enhanced SMTPHandler in Python SVN (trunk) to accept a (username,
password) tuple in a credentials argument to SMTPHandler.__init__().
The credentials, if specified, are used to do a login() call before
the sendmail() call.

Regards,

Vinay




More information about the Python-list mailing list