mailflash.py
def send(self, message):
        """Verifies and sends message.

        :param message: Message instance.
        :param envelope_from: Email address to be used in MAIL FROM command.
        """
        assert message.send_to, "No recipients have been added"

        if message.has_bad_headers(self.mail.default_sender):
            raise BadHeaderError

        if message.date is None:
            message.date = time.time()

        sender = message.sender or self.mail.default_sender
        if self.host:
            self.host.sendmail(sanitize_address(sender) if sender is not None else None,
                               message.send_to,
                               message.as_string(self.mail.default_sender),
                               message.mail_options,
                               message.rcpt_options)

        email_dispatched.send(message, mail=self.mail)

        self.num_emails += 1

        if self.num_emails == self.mail.max_emails:
            self.num_emails = 0
            if self.host:
                self.host.quit()
                self.host = self.configure_host()
def send(self, message):
        """Verifies and sends message.

        :param message: Message instance.
        :param envelope_from: Email address to be used in MAIL FROM command.
        """
        assert message.send_to, "No recipients have been added"

        if message.has_bad_headers(self.mail.default_sender):
            raise BadHeaderError

        if message.date is None:
            message.date = time.time()

        sender = message.sender or self.mail.default_sender
        if self.host:
            self.host.sendmail(sanitize_address(sender) if sender is not None else None,
                               message.send_to,
                               message.as_string(self.mail.default_sender),
                               message.mail_options,
                               message.rcpt_options)

        email_dispatched.send(message, mail=self.mail)

        self.num_emails += 1

        if self.num_emails == self.mail.max_emails:
            self.num_emails = 0
            if self.host:
                self.host.quit()
                self.host = self.configure_host()
Verifies and sends message.

        :param message: Message instance.
        :param envelope_from: Email address to be used in MAIL FROM command.