You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Module smtplib, line 574, in login
Module smtplib, line 538, in encode_cram_md5
Module hmac, line 72, in __init__
TypeError: character mapping must return integer, None or unicode
Following traceback occurs when doing connection.login(u'foobar@domain.com', 'justdoit') to issue an ESMTP.
SMTP (RFC 2821) doesn't support non-ASCII envelope addresses. A better behavior here would be for connection.login to raise a ValueError or a TypeError whenever a non-str is passed in.
RFC 5336, though, adds the UTF8SMTP extension, which adds support for UTF-8 encoded unicode mailboxes. If the server advertises the UTF8SMTP capability, then smtplib could encode unicode using UTF-8 and pass it on.
This is really a feature request (RFC 5336 support), not a bug.
iElectric commented on Apr 21, 2010
iElectricmannequin
MannequinAuthor
More actions
Plone currently just passes unicode data around, maybe additional documentation note will do for avoiding such trobules.
Well, this issue changed into a feature request for UTF8SMTP support, which I do intend to implement at some point.
It does indeed appear like the original problem (not converting unicode strings into ASCII) was fixed in 2.7 at some point, though, which is good news, thanks.
Activity
iElectric commentedon Apr 21, 2010
Module smtplib, line 574, in login
Module smtplib, line 538, in encode_cram_md5
Module hmac, line 72, in __init__
TypeError: character mapping must return integer, None or unicode
Following traceback occurs when doing connection.login(u'foobar@domain.com', 'justdoit') to issue an ESMTP.
Python 2.6.4 (r264:75706, Mar 11 2010, 18:33:18)
exarkun commentedon Apr 21, 2010
SMTP (RFC 2821) doesn't support non-ASCII envelope addresses. A better behavior here would be for connection.login to raise a ValueError or a TypeError whenever a non-str is passed in.
RFC 5336, though, adds the UTF8SMTP extension, which adds support for UTF-8 encoded unicode mailboxes. If the server advertises the UTF8SMTP capability, then smtplib could encode unicode using UTF-8 and pass it on.
This is really a feature request (RFC 5336 support), not a bug.
iElectric commentedon Apr 21, 2010
Plone currently just passes unicode data around, maybe additional documentation note will do for avoiding such trobules.
Thanks for quick response.
tiran commentedon Oct 6, 2012
I've changed the topic and set the version to 3.4.
[-]smtplib.SMTP.login() breaks with unicode input[/-][+]Support UTF8SMTP as part of RFC 5336[/+]bitdancer commentedon Oct 7, 2012
Woops, did not mean to close the issue.
[-]Support UTF8SMTP as part of RFC 5336[/-][+]Support UTF8SMTP as part of RFC 5336 in smtlib[/+][-]Support UTF8SMTP as part of RFC 5336 in smtlib[/-][+]Support UTF8SMTP as part of RFC 5336 in smptlib[/+]hhallman commentedon Feb 23, 2013
Can not reproduce the problem in 2.7
Attaching a patch with test cases proving that the problem is solved.
Patch based on current tip 2.7.
bitdancer commentedon Feb 23, 2013
Well, this issue changed into a feature request for UTF8SMTP support, which I do intend to implement at some point.
It does indeed appear like the original problem (not converting unicode strings into ASCII) was fixed in 2.7 at some point, though, which is good news, thanks.
dlam commentedon Feb 23, 2013
looks like RFC 6531 obsoletes 5336 --> http://datatracker.ietf.org/doc/rfc6531/
(6531 says its the "Proposed Standard", whereas 5336 says its "Experimental" etc etc)
bitdancer commentedon Feb 23, 2013
Thanks for the pointer. I keep reading "SMTPUTF8" as "SMTPUFF", but otherwise at a quick glance it looks like an improvement.
[-]Support UTF8SMTP as part of RFC 5336 in smptlib[/-][+]Support RFC 6531 in smptlib[/+]