fix encoding handling

This commit is contained in:
Frédéric Péters 2012-01-17 13:47:40 +01:00
parent e3013ecc20
commit e7b5b2c28d
1 changed files with 6 additions and 2 deletions

View File

@ -297,9 +297,11 @@ Message:
""") % data
u_message = message
message = message.encode(encoding)
u_subject = _(u'New message from %s') % unicode(portal.title, 'utf-8')
subject = u_subject.encode(encoding)
context.MailHost.send('\n\n'+message, mto, envelope_from,
subject=_(u'New message from %s') % portal.title)
subject=subject)
# and now, send a copy to the sender
if data.get('email'):
@ -307,10 +309,12 @@ Message:
%(message)s
""" % {'message': u_message})
u_subject = _(u'Your message on %s') % unicode(portal.title, 'utf-8')
subject = u_subject.encode(encoding)
try:
context.MailHost.send('\n\n'+message, data.get('email'), envelope_from,
subject=_(u'Your message on %s') % portal.title)
subject=subject)
except:
# ignore everything here, as the most important part has been done
# successfully