'Initialize a new instance.
If specified, `host\' is the name of the remote host to which to
connect.  If specified, `port\' specifies the port to which to connect.
By default, smtplib.SMTP_PORT is used.  An SMTPConnectError is raised
if the specified `host\' doesn\'t respond correctly.  If specified,
`local_hostname` is used as the FQDN of the local host.  By default,
the local hostname is found using socket.getfqdn().'

def __init__(self, host='', port=0, local_hostname=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT):

    self.timeout = timeout
    self.esmtp_features = {}
    if host:
        (code, msg) = self.connect(host, port)
        if (code != 220):
            raise SMTPConnectError(code, msg)
    if (local_hostname is not None):
        self.local_hostname = local_hostname
    else:
        fqdn = socket.getfqdn()
        if ('.' in fqdn):
            self.local_hostname = fqdn
        else:
            addr = '127.0.0.1'
            try:
                addr = socket.gethostbyname(socket.gethostname())
            except socket.gaierror:
                pass
            self.local_hostname = ('[%s]' % addr)
    return
