﻿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
19107	Can't send unicode e-mail	carneiro.be@…	nobody	"Hello guys,

I'm on django dev and having troubles sending unicode emails. Here's the relevant code:

{{{
# person is a normal django user
subject = u""Welcome to Odeio - %s"" % person.name
message = render_to_string('accounts/registration_email.txt', ctx_dict)
person.email_user(subject, message)
}}}


Error: 
{{{
'ascii' codec can't encode character u'\xe1' in position 2: ordinal not in range(128)
}}}


Stacktrace:

{{{
File ""/odeio/django/core/mail/__init__.py"", line 62, in send_mail
    connection=connection).send()
 
  File ""/odeio/django/core/mail/message.py"", line 251, in send
    return self.get_connection(fail_silently).send_messages([self])
 
  File ""/odeio/django/core/mail/backends/smtp.py"", line 91, in send_messages
    sent = self._send(message)
   
  File ""/odeio/django/core/mail/backends/smtp.py"", line 106, in _send
    self.connection.sendmail(from_email, recipients, email_message.message().as_string())
 
  File ""/odeio/django/core/mail/message.py"", line 141, in as_string
    g.flatten(self, unixfrom=unixfrom)
 
  File ""/opt/bitnami/python/lib/python2.6/email/generator.py"", line 84, in flatten
    self._write(msg)
 
  File ""/opt/bitnami/python/lib/python2.6/email/generator.py"", line 109, in _write
    self._dispatch(msg)
 
  File ""/opt/bitnami/python/lib/python2.6/email/generator.py"", line 135, in _dispatch
    meth(msg)
 
  File ""/opt/bitnami/python/lib/python2.6/email/generator.py"", line 178, in _handle_text
    self._fp.write(payload)
 
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in position 2: ordinal not in range(128)
}}}
Thanks in advance for the help!"	Bug	closed	Core (Mail)	1.6	Release blocker	fixed	mail unicode	Ben Kornrath Tim Graham	Accepted	0	0	0	0	0	0
