﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
14301	django crashes on email address that passed validate_email()  (utf8-tld)	harm	nobody	"== description ==
It seems validate_email() and send_email() in django don't agree on the validness of email addresses whenever utf8 is used in the tld.

I'm not sure what is currently allowed the domain part, there is an experimental RFC 5335, but at least django should agree with itself on this matter.

== steps to reproduce ==
{{{
#!python
python manage.py shell
>>> from django.core.validators import validate_email
>>> from django.core.mail import send_mail
>>> email = u'chw08820@nyc.odn.ne.j\uff43'
>>> validate_email(email)
>>> send_mail('subject','message','from@example.com',[email])
}}}
== result ==
{{{
Traceback (most recent call last):
  File ""<console>"", line 1, in <module>
  File ""/opt/python2.5/lib/python2.5/site-packages/django/core/mail/__init__.py"", line 61, in send_mail
    connection=connection).send()
  File ""/opt/python2.5/lib/python2.5/site-packages/django/core/mail/message.py"", line 175, in send
    return self.get_connection(fail_silently).send_messages([self])
  File ""/opt/python2.5/lib/python2.5/site-packages/django/core/mail/backends/smtp.py"", line 85, in send_messages
    sent = self._send(message)
  File ""/opt/python2.5/lib/python2.5/site-packages/django/core/mail/backends/smtp.py"", line 101, in _send
    email_message.message().as_string())
  File ""/opt/python2.5/lib/python2.5/site-packages/django/core/mail/message.py"", line 147, in message
    msg['To'] = ', '.join(self.to)
  File ""/opt/python2.5/lib/python2.5/site-packages/django/core/mail/message.py"", line 86, in __setitem__
    name, val = forbid_multi_line_headers(name, val, self.encoding)
  File ""/opt/python2.5/lib/python2.5/site-packages/django/core/mail/message.py"", line 70, in forbid_multi_line_headers
    result.append(formataddr((nm, str(addr))))
UnicodeEncodeError: 'ascii' codec can't encode character u'\uff43' in position 21: ordinal not in range(128)
}}}

== expected result ==
Either 
 1. validate_email() should reject the email address, 
or 
 2. send_email() should handle the message and attempt to deliver it.

== version ==
django 1.2"		closed	Core (Mail)	1.2		fixed			Accepted	1	0	0	0	0	0
