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
SSH Key
SSH
SSH Tunnel
SFTP

Unreleased...
Bzip2
LZW
Bz2
Icon

 

 

 

 

 

 

 

MIME Encoding - Base64, Quoted-Printable, 8bit

Python script demonstrating how to build MIME messages using different encodings.

Download Python Programming Example Scripts

# file: mimeEncodings.py
# -*- coding: windows-1252 -*-
# (Python MIME parsing and building example script.)

import chilkat 

# Demonstrates how to use different content-transfer-encodings
# such as quoted-printable, base64, and 8bit.
mime = chilkat.CkMime()
mime.UnlockComponent("anything for 30-day trial")

mime.put_Charset("iso-8859-1")
# Begin with 8-bit.
mime.put_Encoding("8bit")
		
# Add some Danish message body text...
mime.SetBodyFromPlainText("Jeg kan spise glas, det gør ikke ondt på mig.")
		    		
print mime.mime() + "\n\n"
		    
#  This MIME is printed:
# 		
# content-transfer-encoding: 8bit
# content-type: text/plain;
# 	 charset="iso-8859-1"
# 
# Jeg kan spise glas, det gør ikke ondt på mig.

		
# Change the encoding to base64:
mime.put_Encoding("base64")
print mime.mime() + "\n\n"
		
#  The MIME is now in base64 format:
# 		
# content-type: text/plain;
# 	 charset="iso-8859-1"
# content-transfer-encoding: base64
# 
# SmVnIGthbiBzcGlzZSBnbGFzLCBkZXQgZ/hyIGlra2Ugb25kdCBw5SBtaWcu

		
# Change the encoding to quoted-printable:
mime.put_Encoding("quoted-printable")
print mime.mime() + "\n\n"
		
#  The MIME is now in quoted-printable format:
# 		
# content-type: text/plain;
# 	 charset="iso-8859-1"
# content-transfer-encoding: quoted-printable
# 
# Jeg kan spise glas, det g=F8r ikke ondt p=E5 mig.


		






 

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

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