def send(self,
             to=None,
             set_mail_to=True,
             mail_from=None,
             set_mail_from=False,
             render=None,
             smtp_mail_options=None,
             smtp_rcpt_options=None,
             smtp=None):

        if render is not None:
            self.render(**render)

        if smtp is None:
            smtp = {'host': 'localhost', 'port': 25, 'timeout': 5}

        if isinstance(smtp, dict):
            smtp = self.smtp_pool[smtp]

        if not hasattr(smtp, 'sendmail'):
            raise ValueError(
                "smtp must be a dict or an object with method 'sendmail'. got %s" % type(smtp))

        to_addrs = None

        if to:
            if set_mail_to:
                self.set_mail_to(to)
            else:
                to_addrs = [a[1] for a in parse_name_and_email_list(to)]

        to_addrs = to_addrs or self.get_recipients_emails()

        if not to_addrs:
            raise ValueError('No to-addr')

        if mail_from:
            if set_mail_from:
                self.set_mail_from(mail_from)
                from_addr = self._mail_from[1]
            else:
                mail_from = parse_name_and_email(mail_from)
                from_addr = mail_from[1]
        else:
            from_addr = self._mail_from[1]

        if not from_addr:
            raise ValueError('No "from" addr')

        params = dict(from_addr=from_addr, to_addrs=to_addrs, msg=self,
                      mail_options=smtp_mail_options, rcpt_options=smtp_rcpt_options)

        return smtp.sendmail(**params)
dataset/ETHPy150Open lavr/python-emails/emails/message.py/MessageSendMixin.send/original