This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ccgus
Recipients ccgus
Date 2008-11-24.03:59:01
SpamBayes Score 1.3311964e-09
Marked as misclassified No
Message-id <>
smtplib requires that messages being sent be in ascii, and throws an exception otherwise.  
Python 2.6 doesn't require this.  Here's the diff where it was introduced:

Is there a good reason for this?  I use python for a webstore, and send out emails for folks 
with multibyte names (for instance, if a name has an umlaut).

Here's a code snippit + exception:

Python 3.0rc3 (r30rc3:67312, Nov 22 2008, 18:45:57) 
[GCC 3.4.6 [FreeBSD] 20060305] on freebsd6
Type "help", "copyright", "credits" or "license" for more information.
>>> import smtplib
>>> server = smtplib.SMTP("localhost")
>>> server.sendmail("", "", "Ümlaut")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/", line 713, in sendmail
    (code,resp) =
  File "/home/", line 481, in data
  File "/home/", line 305, in send
    s = s.encode("ascii")
UnicodeEncodeError: 'ascii' codec can't encode character '\xdc' in position 0: ordinal not in 

Is there a workaround or a new way of using it?  I couldn't seem to find it.

Date User Action Args
2008-11-24 03:59:04ccgussetrecipients: + ccgus
2008-11-24 03:59:04ccgussetmessageid: <>
2008-11-24 03:59:03ccguslinkissue4403 messages
2008-11-24 03:59:01ccguscreate