[Python-ideas] Add SMTPS support to logging.handlers.SMTPHandler

jakedrummond at verizon.net jakedrummond at verizon.net
Fri Jul 24 04:49:26 CEST 2015


Example of modification:

old:

    smtp = smtplib.SMTP(self.mailhost, port, timeout=self._timeout)

new:

    if self.smtps:
        smtp = smtplib.SMTP_SSL(self.mailhost, port, *self.smtps, timeout=self._timeout)
    else:
        smtp = smtplib.SMTP(self.mailhost, port, timeout=self._timeout)

old:

    if self.secure is not None:
        smtp.ehlo()
        smtp.starttls(*self.secure)
        smtp.ehlo()

new:

    smtp.ehlo()
    if self.tls:
        smtp.starttls(*self.tls)
        smtp.ehlo()


More information about the Python-ideas mailing list