(Chilkat2-Python) POP3 Fetch a Single Email by UIDL
Demonstrates how to fetch a single email by UIDL.
import sys
import chilkat2
# This example requires the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.
mailman = chilkat2.MailMan()
mailman.MailHost = "pop.example.com"
mailman.PopUsername = "myLogin"
mailman.PopPassword = "myPassword"
mailman.MailPort = 995
mailman.PopSsl = True
# sa is a CkStringArray
sa = mailman.GetUidls()
if (mailman.LastMethodSuccess == False):
print(mailman.LastErrorText)
sys.exit()
# Download each email by UIDL.
i = 0
numUidls = sa.Count
while i < numUidls :
uidl = sa.GetString(i)
print(uidl)
# email is a CkEmail
email = mailman.FetchEmail(uidl)
if (mailman.LastMethodSuccess == False):
print(mailman.LastErrorText)
sys.exit()
print(email.Subject)
print("")
i = i + 1
|