Re: Ensuring 7 bit encoding

Mark Sapiro <[email protected]>
Newsgroups gmane.comp.python.mime.devel
Organization Not Very Much
Message-ID <PC19220090827174205045388994d8a@msapiro>
Nicholas Cole wrote:
>
>What do I need to do to ensure that emails are generated only in 7,
>not 8-bit encodings?  I assume that I need to use
>email.charset.add_charset , but can't quite work out what incantation
>to give it.  Does anyone have any pointers?


I'm not sure what it is you're asking. Does this answer your question?

>>> import email.message
>>> m = email.message.Message()
>>> m.set_payload("""A few lines
... of 7-bit text
...
... No high bit characters.
... """, 'us-ascii')
>>> print m.as_string()
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit

A few lines
of 7-bit text

No high bit characters.

>>>


-- 
Mark Sapiro <[email protected]>        The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.