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

 

 

 

 

 

 

 

Send Encrypted Email

Python script to send digitally encrypted email.

Download Python Programming Example Scripts

# file: EncryptedEmail.py

import chilkat 

# How to send encrypted email in Python using the Chilkat email module.
mailman = chilkat.CkMailMan()
mailman.UnlockComponent("anything for 30-day trial")

# Set your SMTP server's hostname
mailman.put_SmtpHost("smtp.comcast.net")

# If your SMTP server requires a login, set username/password
# mailman.put_SmtpUsername("myUsername")
# mailman.put_SmtpPassword("myPassword")

# Create a simple email
email = chilkat.CkEmail()
email.put_Subject("Sending email from Python")
email.put_Body("This email was sent from a Python script")
email.put_From("Chilkat Support <support@chilkatsoft.com>")

# Add a single recipient
# It is the digital certificate of the recipient that is used to encrypt.
email.AddTo("TagTooga","admin@tagtooga.com")

# There are a number of ways to send digitally encrypted email using Chilkat.
# This example demonstrates the easiest (other examples will explore
# some of the other possibilities).
# To send an encrypted email, you will first need the digital certificate
# for the recipient. The email address in the certificate should match
# the recipient's email address.  You do not need the private key to send
# encrypted email: only the public-key is required.  The recipient however,
# must have his/her certificate installed with private key in order to decrypt.
# 
# If you have the digital certificate in a .cer file, double-click on it from
# Windows Explorer and install the certificate in the default location.  
# Chilkat should now be able to locate it.  You only need to set the SendEncrypted
# property = true to send encrypted email.  
#
# That's it.  When SendEmail is called, it will locate the certificate matching
# the recipient's email address, encrypt the email (including all attachments) and 
# send it.
email.put_SendEncrypted(True)

# Note: When sending encrypted mail, only one recipient is allowed.  If you wish
# to send the same email to multiple recipients, create a program loop to call
# SendEmail for each recipient.

success = mailman.SendEmail(email)
if (not success):
	mailman.SaveLastError("lastError.txt");





 

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

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