Movatterモバイル変換


[0]ホーム

URL:


Previous PageUp One LevelNext PagePython Library ReferenceContentsModule IndexIndex
Previous:12.8.1 MimeWriter ObjectsUp:12. Internet Data HandlingNext:12.10 multifile

12.9mimify -- MIME processing of mail messages

Deprecated since release 2.3.Theemail package should be used in preference to themimify module. This module is present only to maintain backward compatibility.

Themimify module defines two functions to convert mail messages toand from MIME format. The mail message can be either a simple messageor a so-called multipart message. Each part is treated separately.Mimifying (a part of) a message entails encoding the message asquoted-printable if it contains any characters that cannot berepresented using 7-bit ASCII. Unmimifying (a part of) a messageentails undoing the quoted-printable encoding. Mimify and unmimifyare especially useful when a message has to be edited before beingsent. Typical use would be:

unmimify messageedit messagemimify messagesend message

The modules defines the following user-callable functions anduser-settable variables:

mimify(infile, outfile)
Copy the message ininfile tooutfile, converting parts toquoted-printable and adding MIME mail headers when necessary.infile andoutfile can be file objects (actually, anyobject that has areadline() method (forinfile) or awrite() method (foroutfile)) or strings naming the files.Ifinfile andoutfile are both strings, they may have thesame value.

unmimify(infile, outfile[, decode_base64])
Copy the message ininfile tooutfile, decoding allquoted-printable parts.infile andoutfile can be fileobjects (actually, any object that has areadline() method (forinfile) or awrite() method (foroutfile)) or stringsnaming the files. Ifinfile andoutfile are both strings,they may have the same value.If thedecode_base64 argument is provided and tests true, anyparts that are coded in the base64 encoding are decoded as well.

mime_decode_header(line)
Return a decoded version of the encoded header line inline.This only supports the ISO 8859-1 charset (Latin-1).

mime_encode_header(line)
Return a MIME-encoded version of the header line inline.

MAXLEN
By default, a part will be encoded as quoted-printable when itcontains any non-ASCII characters (characters with the 8th bitset), or if there are any lines longer thanMAXLEN characters(default value 200).

CHARSET
When not specified in the mail headers, a character set must be filledin. The string used is stored inCHARSET, and the defaultvalue is ISO-8859-1 (also known as Latin1 (latin-one)).

This module can also be used from the command line. Usage is asfollows:

mimify.py -e [-l length] [infile [outfile]]mimify.py -d [-b] [infile [outfile]]
to encode (mimify) and decode (unmimify) respectively.infiledefaults to standard input,outfile defaults to standard output.The same file can be specified for input and output.

If the-l option is given when encoding, if there are any lineslonger than the specifiedlength, the containing part will beencoded.

If the-b option is given when decoding, any base64 parts willbe decoded as well.

See Also:

Modulequopri:
Encode and decode MIME quoted-printable files.


Previous PageUp One LevelNext PagePython Library ReferenceContentsModule IndexIndex
Previous:12.8.1 MimeWriter ObjectsUp:12. Internet Data HandlingNext:12.10 multifile
Release 2.2.3, documentation updated on 30 May 2003.
SeeAbout this document... for information on suggesting changes.
[8]ページ先頭

©2009-2026 Movatter.jp