Message253043
This relates to the unresolved issue9208 (Python 2).
SMTPHandler fails when receiving unicode strings.
Example (from msg109621):
import logging,logging.handlers
smtpHandler = logging.handlers.SMTPHandler(
mailhost=("smtp.free.fr",25),
fromaddr="from@free.fr", toaddrs="to@free.fr",
subject=u"error message")
LOG = logging.getLogger()
LOG.addHandler(smtpHandler)
LOG.error(u"accentu\u00E9")
… fails:
--- Logging error ---
Traceback (most recent call last):
File "/usr/lib/python3.5/logging/handlers.py", line 985, in emit
smtp.sendmail(self.fromaddr, self.toaddrs, msg)
File "/usr/lib/python3.5/smtplib.py", line 846, in sendmail
msg = _fix_eols(msg).encode('ascii')
UnicodeEncodeError: 'ascii' codec can't encode character '\xe9' in position 108: ordinal not in range(128)
Call stack:
File "/tmp/x.py", line 8, in <module>
LOG.error(u"accentu\u00E9")
Message: 'accentué'
Arguments: ()
As discussed in msg252928 and msg252931, EmailMessage/send_message should be used instead to resolve this issue.
Patch attached. |
|
Date |
User |
Action |
Args |
2015-10-15 13:02:06 | simon04 | set | recipients:
+ simon04 |
2015-10-15 13:02:06 | simon04 | set | messageid: <1444914126.08.0.971116617077.issue25411@psf.upfronthosting.co.za> |
2015-10-15 13:02:06 | simon04 | link | issue25411 messages |
2015-10-15 13:02:05 | simon04 | create | |
|