The SMTPHandler class, located in the logging.handlers module, supports sending logging messages to an email address via SMTP.

class SMTPHandler( mailhost, fromaddr, toaddrs, subject)
Returns a new instance of the SMTPHandler class. The instance is initialized with the from and to addresses and subject line of the email. The toaddrs should be a list of strings. To specify a non-standard SMTP port, use the (host, port) tuple format for the mailhost argument. If you use a string, the standard SMTP port is used.

emit( record)
Formats the record and sends it to the specified addressees.

getSubject( record)
If you want to specify a subject line which is record-dependent, override this method.

See About this document... for information on suggesting changes.