New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SMTPHandler in the logging module fails with unicode strings #69597
Comments
This relates to the unresolved bpo-9208 (Python 2). SMTPHandler fails when receiving unicode strings. Example (from msg109621): … fails: 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. |
This mostly looks good to me, Vinay. Simon: did you intentionally omit the date header, and if so why? (The smtp server normally adds one, but you can't really depend on that). Adding it would look like: msg['Date'] = email.utils.localtime() (Hmm. I wonder if send_message should add Date header if there isn't one...) |
I omitted the date header w/o intent. Basically because I couldn't quickly figure out how to set it. |
New changeset eb843115e052 by Vinay Sajip in branch '3.4': New changeset b99b3ddd0ac4 by Vinay Sajip in branch '3.5': New changeset 522b5cdffd42 by Vinay Sajip in branch 'default': |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: