Python Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

Python Examples

Quick Start
Python Unicode
Python Byte Array
Python Certs
Python Email
Python Encryption
Python FTP
HTML-to-XML
Python HTTP
Python IMAP
Python MHT
Python MIME
Python RSA
Python S/MIME
Python Signatures
Python Socket
Python Spider
Python Tar
Python Upload
Python XML
Python XMP
Python Zip

More Examples...
String
Email Object
POP3
SMTP
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
DH Key Exchange
DSA

Unreleased...
Bzip2
LZW
Bz2
Icon

 

 

 

 

 

 

 

Extract Files from MIME

Extract files from a MIME message.

Note: The example uses the ExtractPartsToFile method, which is available as a pre-release as of this date (20-May-2008).

Download Chilkat Python Library

import sys
import chilkat

mime = chilkat.CkMime()

success = mime.UnlockComponent("Anything for 30-day trial.")
if (success == False):
    print "Failed to unlock component"
    sys.exit()

#  Load a MIME document from a file:
#  (.mht and .eml files contain MIME).
success = mime.LoadMimeFile("mst.mht")
if (success == False):
    print mime.lastErrorText()
    sys.exit()

sa = mime.ExtractPartsToFiles("c:/temp/mimeParts")
if (sa == None ):
    print mime.lastErrorText()
    sys.exit()

n = sa.get_Count()

#  Display the filepaths of the files created:
for i in range(0,n):
    print sa.getString(i)

 

Need a specific example? Send a request to support@chilkatsoft.com

© 2000-2007 Chilkat Software, Inc. All Rights Reserved.