
This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.
Created on2015-10-15 13:02 bysimon04, last changed2022-04-11 14:58 byadmin. This issue is nowclosed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| SMTPHandler-unicode-v1.patch | simon04,2015-10-15 13:02 | review | ||
| Messages (4) | |||
|---|---|---|---|
| msg253043 -(view) | Author: Simon04 (simon04)* | Date: 2015-10-15 13:02 | |
This relates to the unresolvedissue9208 (Python 2).SMTPHandler fails when receiving unicode strings.Example (frommsg109621):import logging,logging.handlerssmtpHandler = 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 inmsg252928 andmsg252931, EmailMessage/send_message should be used instead to resolve this issue.Patch attached. | |||
| msg253045 -(view) | Author: R. David Murray (r.david.murray)*![]() | Date: 2015-10-15 13:51 | |
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...) | |||
| msg253127 -(view) | Author: Simon04 (simon04)* | Date: 2015-10-17 13:06 | |
I omitted the date header w/o intent. Basically because I couldn't quickly figure out how to set it. | |||
| msg253131 -(view) | Author: Roundup Robot (python-dev)![]() | Date: 2015-10-17 15:24 | |
New changeseteb843115e052 by Vinay Sajip in branch '3.4':Closes#25411: Improved Unicode support in SMTPHandler.https://hg.python.org/cpython/rev/eb843115e052New changesetb99b3ddd0ac4 by Vinay Sajip in branch '3.5':Closes#25411: Merged fix from 3.4.https://hg.python.org/cpython/rev/b99b3ddd0ac4New changeset522b5cdffd42 by Vinay Sajip in branch 'default':Closes#25411: Merged fix from 3.5.https://hg.python.org/cpython/rev/522b5cdffd42 | |||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:22 | admin | set | github: 69597 |
| 2015-10-17 15:24:37 | python-dev | set | status: open -> closed nosy: +python-dev messages: +msg253131 resolution: fixed stage: resolved |
| 2015-10-17 13:06:25 | simon04 | set | messages: +msg253127 |
| 2015-10-15 13:51:45 | r.david.murray | set | nosy: +vinay.sajip messages: +msg253045 |
| 2015-10-15 13:21:54 | simon04 | set | nosy: +r.david.murray |
| 2015-10-15 13:02:06 | simon04 | create | |