In my Python application, I would like to be able to send m开发者_如何学Pythonail to addresses like っていった@example.jp
, démo@example.fr
, or even عرض@وزارة-الأتصالات.مصر
, which are perfectly valid.
When passing the address as UTF-8, I get an UnicodeDecodeException. If I encode the address with address.encode('utf-8')
, no Python error but I get bounce mail explaining Diagnostic-Code: smtp; 501 Malformed RCPT TO: - psmtp
.
What's the way to make everything work ?
Thanks.
Make sure the server you're talking to includes UTF8SMTP
in its EHLO
response. Otherwise it doesn't support rfc5336. You can tell by using telnet or netcat to connect to the server and pretending to be an SMTP client.
精彩评论