Sample code for 30+ languages & platforms
CkPython

Transition from Imap.FetchHeaders to Imap.FetchMsgSet

Provides instructions for replacing deprecated FetchHeaders method calls with FetchMsgSet.

Chilkat CkPython Downloads

CkPython
import sys
import chilkat

success = False

imap = chilkat.CkImap()

# ...
# ...

mset = chilkat.CkMessageSet()
success = imap.QueryMbx("FROM joe@example.com",True,mset)
# ...
# ...

# ------------------------------------------------------------------------
# The FetchHeaders method is deprecated:

# bundleObj is a CkEmailBundle
bundleObj = imap.FetchHeaders(mset)
if (imap.get_LastMethodSuccess() == False):
    print(imap.lastErrorText())
    sys.exit()

# ...
# ...

# ------------------------------------------------------------------------
# Do the equivalent using FetchMsgSet.
# Your application creates a new, empty EmailBundle object which is passed 
# in the last argument and filled upon success.

headersOnly = True

bundleOut = chilkat.CkEmailBundle()
success = imap.FetchMsgSet(headersOnly,mset,bundleOut)
if (success == False):
    print(imap.lastErrorText())
    sys.exit()