python / cpython

The Python programming language
https://www.python.org
Other
62.35k stars 29.94k forks source link

Support RFC 6531 in smptlib #52735

Closed 9c0486b8-adb9-4667-a791-e8e2561fb145 closed 9 years ago

9c0486b8-adb9-4667-a791-e8e2561fb145 commented 14 years ago
BPO 8489
Nosy @warsaw, @tiran, @ezio-melotti, @bitdancer
Superseder
  • bpo-22027: RFC 6531 (SMTPUTF8) support in smtplib
  • Files
  • issue8489.patch
  • 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: ```python assignee = None closed_at = created_at = labels = ['easy', 'type-feature', 'library', 'expert-email'] title = 'Support RFC 6531 in smptlib' updated_at = user = 'https://bugs.python.org/iElectric' ``` bugs.python.org fields: ```python activity = actor = 'r.david.murray' assignee = 'none' closed = True closed_date = closer = 'r.david.murray' components = ['Library (Lib)', 'email'] creation = creator = 'iElectric' dependencies = [] files = ['29181'] hgrepos = [] issue_num = 8489 keywords = ['patch', 'easy'] message_count = 9.0 messages = ['103890', '103893', '103901', '172266', '172278', '182763', '182772', '182808', '182825'] nosy_count = 9.0 nosy_names = ['barry', 'exarkun', 'christian.heimes', 'iElectric', 'ezio.melotti', 'r.david.murray', 'dlam', 'moijes12', 'hhallman'] pr_nums = [] priority = 'normal' resolution = 'duplicate' stage = 'resolved' status = 'closed' superseder = '22027' type = 'enhancement' url = 'https://bugs.python.org/issue8489' versions = ['Python 3.5'] ```

    9c0486b8-adb9-4667-a791-e8e2561fb145 commented 14 years ago

    Module smtplib, line 574, in login Module smtplib, line 538, in encode_crammd5 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)

    8726d1eb-a365-45b6-b81d-c75988975e5a commented 14 years ago

    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.

    9c0486b8-adb9-4667-a791-e8e2561fb145 commented 14 years ago

    Plone currently just passes unicode data around, maybe additional documentation note will do for avoiding such trobules.

    Thanks for quick response.

    tiran commented 11 years ago

    I've changed the topic and set the version to 3.4.

    bitdancer commented 11 years ago

    Woops, did not mean to close the issue.

    e1a7de33-55ee-4554-bb49-ad90cd4fd3db commented 11 years ago

    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 commented 11 years ago

    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.

    4fddca73-bb6c-4257-9ca8-057376e53120 commented 11 years ago

    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 commented 11 years ago

    Thanks for the pointer. I keep reading "SMTPUTF8" as "SMTPUFF", but otherwise at a quick glance it looks like an improvement.