[issue37572] email lib bug

2019-07-12 Thread famu xu


New submission from famu xu :

file: email\_header_value_parser.py

line : encoded_part = part.fold(policy=policy)[:-1] # strip nl
modify to: encoded_part = part.fold(policy=policy)[:-2] # strip nl

because the nl is "\r\n"

--
components: email
messages: 347740
nosy: barry, famu xu, r.david.murray
priority: normal
severity: normal
status: open
title: email lib bug
versions: Python 3.6

___
Python tracker 
<https://bugs.python.org/issue37572>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37572] email lib bug

2019-07-12 Thread famu xu


famu xu  added the comment:

python 3.7 same

--

___
Python tracker 
<https://bugs.python.org/issue37572>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37572] email lib bug

2019-07-13 Thread famu xu

famu xu  added the comment:

import smtplib
from email.message import EmailMessage
from email.utils import formataddr

server = smtplib.SMTP('smtp.xxx.com',port=25)
server.login('y...@xxx.com', 'password')
msg = EmailMessage()

#if address username include Chinese or other multibytes language, it will be 
encode to utf8 and base64, like '?utf-8?B?6YKu5Lu25rWL6K+V?= ', 
but the raw smtp request data error, "From: xxx" and "To: xxx" fields has the 
error end char:"\r\r\r\r\n".
#From: ?utf-8?B?6YKu5Lu25rWL6K+V?= \r\r\r\r\n

msg['From'] =formataddr(('中文','y...@xxx.com'))
msg['To'] = formataddr(('中文姓名','t...@yyy.com'))

msg['Subject'] =subject
msg.set_content('something')

server.send_message(msg)
server.quit()

--

___
Python tracker 
<https://bugs.python.org/issue37572>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com