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.
This commit is contained in:
+3
-3
@@ -777,16 +777,16 @@ class Mail(object):
|
|||||||
if attachments:
|
if attachments:
|
||||||
result = mail.send_mail(
|
result = mail.send_mail(
|
||||||
sender=sender, to=origTo,
|
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)
|
attachments=attachments, **xcc)
|
||||||
elif html and (not raw):
|
elif html and (not raw):
|
||||||
result = mail.send_mail(
|
result = mail.send_mail(
|
||||||
sender=sender, to=origTo,
|
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:
|
else:
|
||||||
result = mail.send_mail(
|
result = mail.send_mail(
|
||||||
sender=sender, to=origTo,
|
sender=sender, to=origTo,
|
||||||
subject=str(subject), body=str(text), **xcc)
|
subject=unicode(subject, encoding), body=unicode(text, encoding), **xcc)
|
||||||
else:
|
else:
|
||||||
smtp_args = self.settings.server.split(':')
|
smtp_args = self.settings.server.split(':')
|
||||||
kwargs = dict(timeout=self.settings.timeout)
|
kwargs = dict(timeout=self.settings.timeout)
|
||||||
|
|||||||
Reference in New Issue
Block a user