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

Unreleased...
Service
PPMD
Deflate
Bzip2
LZW
Bz2
DH Key Exchange
DSA
Icon

 

 

 

 

 

 

 

Using GMail as your SMTP Server

Python script showing how to use GMail as your SMTP server for sending email.

Download Python Programming Example Scripts

# file: GMail.py

# Python script to send email using GMail for your SMTP server.

import chilkat 

# Create a mailman object for sending mail.
mailman = chilkat.CkMailMan()
mailman.UnlockComponent("anything for 30-day trial")

# Set your SMTP server's hostname
mailman.put_SmtpHost("smtp.gmail.com")

# GMail requires a login/password to send mail.
mailman.put_SmtpUsername("loginName@gmail.com")
mailman.put_SmtpPassword("password")

# The default SMTP port is 25.  When using it, GMail requires STARTTLS.
mailman.put_StartTLS(True)

# Alternatively, you may comment-out the STARTTLS line and instead use SSL
# on port 465 by commenting-in these 2 lines:
#mailman.put_SmtpPort(465)
#mailman.put_SmtpSsl(True)

# If you are connected to a network that blocks outbound port 25 connections,
# use GMail's alternative port 587.  You'll need STARTTLS, so uncomment the 
# STARTTLS line and make sure the two lines for SMTP SSL are commented out.
#mailman.put_SmtpPort(587)

# Create a new email object...
email = chilkat.CkEmail()
email.put_Subject("Python sent this email using GMail's SMTP server")
email.put_Body("This mail was sent using GMail from a Python script!")
email.put_From("Chilkat Support <support@chilkatsoft.com>")

# Add a few recipients
email.AddTo("Matt","matt@chilkatsoft.com")
email.AddTo("TagTooga","admin@tagtooga.com")

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.