logging module, SMTPHandler and gmail in python 2.6

Vinay Sajip vinay_sajip at yahoo.co.uk
Sun Dec 6 13:12:25 EST 2009


On Dec 4, 12:31 pm, mynthon <mynth... at gmail.com> wrote:

Thank you for this suggestion. Ideally, you would have created an
issue for this on bugs.python.org, because then it would be more
likely to be acted upon.

I've implemented this feature in r76691 (in Python trunk and py3k) in
a more general way. It works by specifying an optional secure argument
to SMTPHandler.__init__. This defaults to None, which implements the
current behaviour - no TLS support.

If TLS support is required, pass in a tuple for secure, with one of
the following values:

1. An empty tuple
2. A 1-tuple with the name of the PEM-formatted keyfile with a private
key.
3. A 2-tuple with the name of the PEM-formatted keyfile and a PEM-
formatted certificate chain file.

This tuple, if specified, is passed to the SMTP object's starttls
method (and via that to socket.ssl). Check the starttls/ssl methods
for more information.

Regards,

Vinay Sajip



More information about the Python-list mailing list