'Closes the connection to the email server.'

def close(self):

    try:
        self.connection.quit()
    except socket.sslerror:
        self.connection.close()
    except:
        if self.fail_silently:
            return
        raise
    finally:
        self.connection = None
