Chilkat
HOME
Android™
ASP
Visual Basic
VB.NET
C#
iOS (IPhone)
Objective-C
C++
C
MFC
Delphi
FoxPro
Java
Perl
PHP Extension
PHP ActiveX
Python
PowerShell
Ruby
SQL Server
VBScript
|
SMTP Authentication
Discusses SMTP authentication using the Chilkat Python email module. # 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("Joe","joe@gmail.com") # Send the email success = mailman.SendEmail(email) if (not success): mailman.SaveLastError("lastError.txt"); |
© 2000-2010 Chilkat Software, Inc. All Rights Reserved.