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

 

 

 

 

 

 

 

SMTP Authentication

Discusses SMTP authentication using the Chilkat Python email module.

Download Python Programming Example Scripts

# file: SmtpAuthentication.py

import chilkat

# About SMTP Authentication when sending email in Python.
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("***")

# Your SMTP server may or may not require authentication.  It often depends
# upon the location where the SMTP client is making the connection.  If the
# SMTP server is behind a firewall, it is often administered such that clients
# connecting from the same side of the firewall (i.e. within the network) can
# send email without authentication.  However, connections originating from
# outside the firewall DO require authentication.  This is quite often the
# case with cable modem and DSL ISP's.  
# If authentication is required, different SMTP servers support different authentication
# methods, some of which are more secure than others.  In the least secure scenario,
# your login/password is transmitted in clear-text (i.e. unencrypted) over the TCP/IP
# connection to the SMTP server.  This is with the "LOGIN" method.
# The "PLAIN" SMTP authentication method is effectively no better because the information
# is simply Base64 encoded.  The CRAM-MD5 and NTLM methods are secure because the
# login/password is sent encrypted.  However, if your connection to the SMTP server is
# SSL, or if you are using the STARTTLS option, it doesn't matter if the authentication
# method is LOGIN or PLAIN because the TCP/IP connection is SSL anyway.
# By default, Chilkat will choose the most secure authentication method available
# (as announced by the SMTP server during the initial "hello" handshake).
# If for some reason there is a problem, or if you desire less-secure authentication,
# you may explicitly set the SmtpAuthMethod property to: "LOGIN", "PLAIN", "CRAM-MD5", or "NTLM".
mailman.put_SmtpAuthMethod("LOGIN")

# Create an e-mail object
email = chilkat.CkEmail()
email.put_Subject("How to send e-mail in the Python programming language")
email.put_Body("Email sent 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")

# Send the email
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.