Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#Mono C#.NET Core C#C# UWP/WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicPythonRubySQL ServerSwiftTclUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET UWP/WinRTVBScriptXojo PluginNode.jsExcel

Python Examples


ASN.1
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Service Bus
Bounced Email
Box
CSR
CSV
Certificates
Compression
DKIM / DomainKey
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
ECC
Email Object
Encryption
FTP
Facebook
Firebase
GeoOp
Google APIs
Google Calendar
Google Cloud Storage
Google Drive
Gzip
HTML-to-XML/Text
HTTP
HTTP Misc
IMAP
JSON
JSON Web Encryption (JWE)
JSON Web Signatures (JWS)
JSON Web Token (JWT)
Java KeyStore (JKS)

Jira
MHT / HTML Email
MIME
Microsoft Graph
NTLM
OAuth1
OAuth2
OneDrive
OpenSSL
Outlook
PEM
PFX/P12
POP3
PRNG
PayPal
Peoplevox
QuickBooks
REST
REST Misc
RSA Encryption
SCP
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
SharePoint
Shopify
Socket/SSL/TLS
Spider
Stream
Stripe
SugarCRM
Tar Archive
Twitter
VoiceBase
Walmart
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Xero
Zip
curl
eBay

 

 

 

(Python) POP3 STARTTLS

Demonstrates how to do POP3 STARTTLS.

Chilkat Python Downloads

Python Module for Windows, Linux, MAC OS X,
Solaris, FreeBSD, and ARM Embedded Linux

import sys
import chilkat

#  The mailman object is used for receiving (POP3)
#  and sending (SMTP) email.
mailman = chilkat.CkMailMan()

#  Any string argument automatically begins the 30-day trial.
success = mailman.UnlockComponent("30-day trial")
if (success != True):
    print("Component unlock failed")
    sys.exit()

#  Set the POP3 server's hostname
mailman.put_MailHost("pop.gmail.com")

#  Set the POP3 login/password.
mailman.put_PopUsername("****@gmail.com")
mailman.put_PopPassword("****")

#  Indicate that we want TLS/SSL.  Also, set the port to 995:
mailman.put_MailPort(995)
mailman.put_PopSsl(True)

#  Read mail headers and one line of the body.
# bundle is a CkEmailBundle
bundle = mailman.CopyMail()

if (bundle == None ):
    print(mailman.lastErrorText())
    sys.exit()

for i in range(0,bundle.get_MessageCount()):
    # email is a CkEmail
    email = bundle.GetEmail(i)

    #  Display the From email address and the subject.
    print("From: " + email.ck_from())
    print("Subject: " + email.subject())


 

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