<p>密钥在<a href="http://docs.python.org/3.1/library/email.mime.html#email.mime.text.MIMEText" rel="noreferrer">the docs</a>:</p>
<pre><code>class email.mime.text.MIMEText(_text, _subtype='plain', _charset='us-ascii')
</code></pre>
<blockquote>
<p>A subclass of MIMENonMultipart, the
MIMEText class is used to create MIME
objects of major type text. _text is
the string for the payload. _subtype
is the minor type and defaults to
plain. _charset is the character set
of the text and is passed as a
parameter to the MIMENonMultipart
constructor; it defaults to us-ascii.
No guessing or encoding is performed
on the text data.</p>
</blockquote>
<p>所以你需要的显然是,<em>不是</em><code>msg = MIMEText('€10')</code>,而是:</p>
<pre><code>msg = MIMEText('€10'.encode('utf-8'), _charset='utf-8')
</code></pre>
<p>虽然并非所有这些都有清晰的文档记录,<a href="http://docs.python.org/3.1/library/smtplib.html?highlight=smtplib#smtplib.SMTP.sendmail" rel="noreferrer">sendmail</a>需要一个字节字符串,而不是一个Unicode字符串(这是SMTP协议指定的);看看构建它的两种方法中的每一种方法的<code>msg.as_string()</code>是什么样子的——考虑到“没有猜测或编码”,您的方法中仍然有那个欧元字符(sendmail也没有办法将其转换为byte string),我的没有(而且utf-8在整个过程中都有明确的说明)。</p>