[Vladimir Petrovic wrote (vladap@criticalpublics.com) on 7/3/03 10:58 AM]
On Wednesday 02 July 2003 21:34, george donnelly wrote:
I have a script that produces an email (in Spanish) when new content is published. I can get the body of the email to show up correctly (ie the accents etc render correctly) but the subject turns spanish characters into garbage.
SMTP message header has to be encoded specially if it contains non ascii characters. Subject has to be of the form: =?<enc>?b?<text>?=
and text should be base64 encoded.
Here is a simple script that will generate proper header value for a UTF-8 string:
thanks for your suggestion and the script. I ended up doing it this way: ------ from email.Header import Header ...... esSubject = Header(contentObject.Title(), 'utf-8') essString = str(esSubject) ........ mSubj = essString mailhost.send(mMsg, subject=mSubj, encode='quoted-printable') ------ <--> george donnelly - http://www.zettai.net/ - "Quality Zope Hosting" Zope Hosting - Dynamic Website Design - Search Engine Promotion Yahoo, AIM: zettainet - MSN: zettainet@hotmail.com - ICQ: 51907738