def patch_message(self, message):
        """
        Some SMTP requires from and to emails
        """

        if self.from_email:
            message.mail_from = (message.mail_from[0], self.from_email)

        if self.to_email:
            message.mail_to = self.to_email

        # TODO: this code breaks template in subject; fix it
        if not to_unicode(message.subject).startswith(self.subject_prefix) :
            message.subject = " ".join([self.subject_prefix, message.subject,
                                        'py%s' % sys.version[:3]])

        message._headers['X-Test-Date'] = datetime.datetime.utcnow().isoformat()
        message._headers['X-Python-Version'] = "%s/%s" % (platform.python_version(), platform.platform())

        return message
dataset/ETHPy150Open lavr/python-emails/emails/testsuite/conftest.py/SMTPTestParams.patch_message/original