'Sends one or more EmailMessage objects and returns the number of email
messages sent.'

def send_messages(self, email_messages):

    if (not email_messages):
        return
    with self._lock:
        new_conn_created = self.open()
        if (not self.connection):
            return
        num_sent = 0
        for message in email_messages:
            sent = self._send(message)
            if sent:
                num_sent += 1
        if new_conn_created:
            self.close()
    return num_sent
