Merge pull request #964 from matclab/mail-send-lazy-to-unicode
#963 : Convert subject and body to unicode before sending mail
This commit is contained in:
+5
-5
@@ -767,8 +767,8 @@ class Mail(object):
|
|||||||
if self.settings.server == 'logging':
|
if self.settings.server == 'logging':
|
||||||
logger.warn('email not sent\n%s\nFrom: %s\nTo: %s\nSubject: %s\n\n%s\n%s\n' %
|
logger.warn('email not sent\n%s\nFrom: %s\nTo: %s\nSubject: %s\n\n%s\n%s\n' %
|
||||||
('-' * 40, sender,
|
('-' * 40, sender,
|
||||||
', '.join(to), subject,
|
', '.join(to), subject,
|
||||||
text or html, '-' * 40))
|
text or html, '-' * 40))
|
||||||
elif self.settings.server == 'gae':
|
elif self.settings.server == 'gae':
|
||||||
xcc = dict()
|
xcc = dict()
|
||||||
if cc:
|
if cc:
|
||||||
@@ -786,16 +786,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=subject, body=text, html=html,
|
subject=unicode(subject), body=unicode(text), 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=subject, body=text, html=html, **xcc)
|
subject=unicode(subject), body=unicode(text), html=html, **xcc)
|
||||||
else:
|
else:
|
||||||
result = mail.send_mail(
|
result = mail.send_mail(
|
||||||
sender=sender, to=origTo,
|
sender=sender, to=origTo,
|
||||||
subject=subject, body=text, **xcc)
|
subject=unicode(subject), body=unicode(text), **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