From ba2cb811be102ea83f9c254d475a05405064d0f8 Mon Sep 17 00:00:00 2001 From: rafaelol Date: Thu, 7 Jan 2016 14:59:58 -0200 Subject: [PATCH] Changes encoding of text and subject on Mail.send() On the previous commit we changed text and subject from unicode to str. After a better solution from @cassiobotaro, we're using unicode again, selecting the encoding as the one passed via encoding parameter. --- gluon/tools.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gluon/tools.py b/gluon/tools.py index 3eee9d8a..63281234 100644 --- a/gluon/tools.py +++ b/gluon/tools.py @@ -777,16 +777,16 @@ class Mail(object): if attachments: result = mail.send_mail( sender=sender, to=origTo, - subject=str(subject), body=str(text), html=html, + subject=unicode(subject, encoding), body=unicode(text, encoding), html=html, attachments=attachments, **xcc) elif html and (not raw): result = mail.send_mail( sender=sender, to=origTo, - subject=str(subject), body=str(text), html=html, **xcc) + subject=unicode(subject, encoding), body=unicode(text, encoding), html=html, **xcc) else: result = mail.send_mail( sender=sender, to=origTo, - subject=str(subject), body=str(text), **xcc) + subject=unicode(subject, encoding), body=unicode(text, encoding), **xcc) else: smtp_args = self.settings.server.split(':') kwargs = dict(timeout=self.settings.timeout)