Python Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CMFCDelphiFoxProJavaPerl
PHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

Python Examples

Quick Start
Unicode
Byte Array
Bz2
Certificates
CSV
Email
Encryption
FTP
HTML Conversion
HTTP
IMAP
MHT
MIME
POP3
RSA
S/MIME
Signatures
Socket / SSL
SFTP
SMTP
Spider
SSH Key
SSH
SSH Tunnel
Tar
HTTP Upload
XML
XMP
Zip

More Examples...
String
Amazon S3
Email Object
DKIM / DomainKey
NTLM
FileAccess
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
DH Key Exchange
DSA
Bzip2
LZW

 

 

 

 

 

 

 

Sending to Multiple Email Recipients (TO, CC, BCC)

 Chilkat Python Module Downloads for Windows, Linux, and MAC OS X

How to send email to multiple recipients in Python.

# file: MultipleRecipients.py

import chilkat

# Demonstrate how to add multiple To, CC, and BCC recipients
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 authentication, set username/password
#mailman.put_SmtpUsername("***")
#mailman.put_SmtpPassword("***")

# Create an e-mail object
email = chilkat.CkEmail()
email.put_Subject("Send email in Python to multiple recipients")
email.put_Body("Email with multiple recipients (To, CC, BCC)")
email.put_From("Chilkat Support <support@chilkatsoft.com>")

# Call AddTo, AddCC, and AddBCC multiple times, one for each recipient
email.AddTo("Matt","matt@chilkatsoft.com")
email.AddTo("Chilkat Blog","admin@cknotes.com")

email.AddCC("John","john@chilkatsoft.com")
email.AddCC("Joe","joe@chilkatsoft.com")

# BCC header fields do not appear in the MIME source of the email.
# they are only delivered to the SMTP server in the form of "RCPT TO" commands
# during the mail sending.  Therefore, "To" and "CC" recipients cannot possibly
# know about the BCC recipients.
email.AddBcc(" Bob","bob@cknotes.com")
email.AddBcc("Jim","jim@cknotes.com")

# Your program may clear recipients by calling ClearTo, ClearCC, or ClearBcc
# These will be commented out in this example:
#email.ClearTo()
#email.ClearCC()
#email.ClearBcc()

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







 

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