Merge pull request #1163 from rafaelol/fixes_mail_encoding_bug_for_non_ascii_text

Fix bug on Mail.send() when text or input are Unicode
This commit is contained in:
mdipierro
2016-01-29 22:17:07 -06:00

View File

@@ -777,16 +777,16 @@ class Mail(object):
if attachments:
result = mail.send_mail(
sender=sender, to=origTo,
subject=unicode(subject), body=unicode(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=unicode(subject), body=unicode(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=unicode(subject), body=unicode(text), **xcc)
subject=unicode(subject, encoding), body=unicode(text, encoding), **xcc)
else:
smtp_args = self.settings.server.split(':')
kwargs = dict(timeout=self.settings.timeout)