'Ensure an open connection to the email server. Return whether or not a
new connection was required (True or False) or None if an exception
passed silently.'

def open(self):

    if self.connection:
        return False
    connection_params = {'local_hostname': DNS_NAME.get_fqdn()}
    if (self.timeout is not None):
        connection_params['timeout'] = self.timeout
    if self.use_ssl:
        connection_params.update({'keyfile': self.ssl_keyfile, 'certfile': self.ssl_certfile})
    try:
        self.connection = self.connection_class(self.host, self.port, **connection_params)
        if ((not self.use_ssl) and self.use_tls):
            self.connection.starttls(keyfile=self.ssl_keyfile, certfile=self.ssl_certfile)
        if (self.username and self.password):
            self.connection.login(self.username, self.password)
        return True
    except (smtplib.SMTPException, socket.error):
        if (not self.fail_silently):
            raise
