'Initialize the handler.
Initialize the instance with the from and to addresses and subject
line of the email. To specify a non-standard SMTP port, use the
(host, port) tuple format for the mailhost argument. To specify
authentication credentials, supply a (username, password) tuple
for the credentials argument. To specify the use of a secure
protocol (TLS), pass in a tuple for the secure argument. This will
only be used when authentication credentials are supplied. The tuple
will be either an empty tuple, or a single-value tuple with the name
of a keyfile, or a 2-value tuple with the names of the keyfile and
certificate file. (This tuple is passed to the `starttls` method).'

def __init__(self, mailhost, fromaddr, toaddrs, subject, credentials=None, secure=None):

    logging.Handler.__init__(self)
    if isinstance(mailhost, (list, tuple)):
        (self.mailhost, self.mailport) = mailhost
    else:
        (self.mailhost, self.mailport) = (mailhost, None)
    if isinstance(credentials, (list, tuple)):
        (self.username, self.password) = credentials
    else:
        self.username = None
    self.fromaddr = fromaddr
    if isinstance(toaddrs, basestring):
        toaddrs = [toaddrs]
    self.toaddrs = toaddrs
    self.subject = subject
    self.secure = secure
    self._timeout = 5.0
