Skip to content

Instantly share code, notes, and snippets.

@bmispelon
Created September 13, 2017 14:15
Show Gist options
  • Select an option

  • Save bmispelon/cec9eb33305d55776583010e431633bf to your computer and use it in GitHub Desktop.

Select an option

Save bmispelon/cec9eb33305d55776583010e431633bf to your computer and use it in GitHub Desktop.
Python 2.7.3 (default, Mar 13 2014, 11:03:55)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django.core.mail import send_mail
>>> send_mail('hello', 'world', '[email protected]', [u'Báptiste [asdf] <[email protected]>'])
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/path/to/venv/local/lib/python2.7/site-packages/django/core/mail/__init__.py", line 62, in send_mail
return mail.send()
File "/path/to/venv/local/lib/python2.7/site-packages/django/core/mail/message.py", line 342, in send
return self.get_connection(fail_silently).send_messages([self])
File "/path/to/venv/local/lib/python2.7/site-packages/django/core/mail/backends/smtp.py", line 107, in send_messages
sent = self._send(message)
File "/path/to/venv/local/lib/python2.7/site-packages/django/core/mail/backends/smtp.py", line 123, in _send
self.connection.sendmail(from_email, recipients, message.as_bytes(linesep='\r\n'))
File "/usr/lib/python2.7/smtplib.py", line 727, in sendmail
(code, resp) = self.rcpt(each, rcpt_options)
File "/usr/lib/python2.7/smtplib.py", line 479, in rcpt
self.putcmd("rcpt", "TO:%s%s" % (quoteaddr(recip), optionlist))
File "/usr/lib/python2.7/smtplib.py", line 334, in putcmd
self.send(str)
File "/usr/lib/python2.7/smtplib.py", line 321, in send
self.sock.sendall(str)
File "/usr/lib/python2.7/socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in position 10: ordinal not in range(128)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment