{"action":"closed","issue":{"url":"https://api.github.com/repos/odoo/odoo/issues/23502","repository_url":"https://api.github.com/repos/odoo/odoo","labels_url":"https://api.github.com/repos/odoo/odoo/issues/23502/labels{/name}","comments_url":"https://api.github.com/repos/odoo/odoo/issues/23502/comments","events_url":"https://api.github.com/repos/odoo/odoo/issues/23502/events","html_url":"https://github.com/odoo/odoo/issues/23502","id":302828034,"number":23502,"title":"[11.0] ir_mail_server: UnicodeEncodeError for user.name with special chars","user":{"login":"moylop260","id":6644187,"avatar_url":"https://avatars0.githubusercontent.com/u/6644187?v=4","gravatar_id":"","url":"https://api.github.com/users/moylop260","html_url":"https://github.com/moylop260","followers_url":"https://api.github.com/users/moylop260/followers","following_url":"https://api.github.com/users/moylop260/following{/other_user}","gists_url":"https://api.github.com/users/moylop260/gists{/gist_id}","starred_url":"https://api.github.com/users/moylop260/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moylop260/subscriptions","organizations_url":"https://api.github.com/users/moylop260/orgs","repos_url":"https://api.github.com/users/moylop260/repos","events_url":"https://api.github.com/users/moylop260/events{/privacy}","received_events_url":"https://api.github.com/users/moylop260/received_events","type":"User","site_admin":false},"labels":[{"id":712046675,"url":"https://api.github.com/repos/odoo/odoo/labels/11.0","name":"11.0","color":"80f438","default":false},{"id":616698546,"url":"https://api.github.com/repos/odoo/odoo/labels/Framework","name":"Framework","color":"E5E970","default":false},{"id":459380541,"url":"https://api.github.com/repos/odoo/odoo/labels/Need%20information","name":"Need information","color":"1d76db","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-03-06T19:10:06Z","updated_at":"2018-03-08T10:26:53Z","closed_at":"2018-03-08T10:26:53Z","author_association":"CONTRIBUTOR","body":"Impacted versions:\r\n11.0 (I don't know if older ones too)\r\n\r\nSteps to reproduce:\r\n1. Create a user with `name` using special char like as `Moisés López`\r\n2. Create an invoice and use `send email` button\r\n\r\nCurrent behavior:\r\n\r\n - The email is not sent\r\n<img width=\"364\" alt=\"screen shot 2018-03-06 at 13 07 29\" src=\"https://user-images.githubusercontent.com/6644187/37052590-58edebba-213f-11e8-845c-e5a87edd8024.png\">\r\n\r\nThe traceback is:\r\n```bash\r\n2018-03-06 19:03:03,608 1355 ERROR vauxoo110 odoo.addons.mail.models.mail_mail: failed sending mail (id: 21273) due to ascii Moisés ordinal not in range(128)\r\nTraceback (most recent call last):\r\n  File \"addons/mail/models/mail_mail.py\", line 323, in _send\r\n    headers=headers)\r\n  File \"odoo/addons/base/ir/ir_mail_server.py\", line 308, in build_email\r\n    msg['From'] = encode_rfc2822_address_header(email_from)\r\n  File \"odoo/addons/base/ir/ir_mail_server.py\", line 123, in encode_rfc2822_address_header\r\n    return COMMASPACE.join(encode_addr(a) for a in addresses)\r\n  File \"odoo/addons/base/ir/ir_mail_server.py\", line 123, in <genexpr>\r\n    return COMMASPACE.join(encode_addr(a) for a in addresses)\r\n  File \"odoo/addons/base/ir/ir_mail_server.py\", line 120, in encode_addr\r\n    return formataddr((name, email))\r\n  File \"/usr/lib/python3.5/email/utils.py\", line 91, in formataddr\r\n    address.encode('ascii')\r\nUnicodeEncodeError: 'ascii' codec can't encode character '\\xe9' in position 4: ordinal not in range(128)\r\n```\r\n\r\nExpected behavior:\r\n - Email sent\r\n\r\nYou can reproduce this error using the following line of code:\r\n`PYTHONPATH=~/odoo python3.5 -c \"from odoo.addons.base.ir.ir_mail_server import encode_rfc2822_address_header as ench;ench('Moisés')\"`\r\n\r\ntraceback\r\n```bash\r\nTraceback (most recent call last):\r\n  File \"<string>\", line 1, in <module>\r\n  File \"/odoo/addons/base/ir/ir_mail_server.py\", line 123, in encode_rfc2822_address_header\r\n    return COMMASPACE.join(encode_addr(a) for a in addresses)\r\n  File \"/odoo/addons/base/ir/ir_mail_server.py\", line 123, in <genexpr>\r\n    return COMMASPACE.join(encode_addr(a) for a in addresses)\r\n  File \"/odoo/addons/base/ir/ir_mail_server.py\", line 120, in encode_addr\r\n    return formataddr((name, email))\r\n  File \"/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/email/utils.py\", line 91, in formataddr\r\n    address.encode('ascii')\r\nUnicodeEncodeError: 'ascii' codec can't encode character '\\xe9' in position 4: ordinal not in range(128)\r\n```\r\n\r\n<img width=\"1261\" alt=\"screen shot 2018-03-06 at 13 23 31\" src=\"https://user-images.githubusercontent.com/6644187/37053383-9dee807e-2141-11e8-8e73-533deb263d41.png\">\r\n"}}
{"actor":{"display_login":"Elkasitu"}}