2

In my Python application, I would like to be able to send mail 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.

Pierre
  • 6,084
  • 5
  • 32
  • 52
  • as far as i know, non-ascii-chars in the localpart (before '@') are not allowed. The domain-part (after '@') must be IDN-encoded if non-ascii. Dunno about python. – Markus Kull Oct 06 '10 at 14:50
  • non-ascii chars in the localpart are allowed, and valid. Well, pretty much anything is valid before the @, in fact. – Pierre Oct 06 '10 at 15:00
  • Have a look at this answer: http://stackoverflow.com/a/9527510/633961 – guettli Oct 05 '12 at 07:32

1 Answers1

2

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.

Community
  • 1
  • 1
nmichaels
  • 49,466
  • 12
  • 107
  • 135
  • Yep, thanks. Seems like the packaged version of Postfix in Ubuntu doesn't support that feature... – Pierre Oct 06 '10 at 14:58