Sample code for 30+ languages & platforms
Chilkat2-Python

Transition from Imap.FetchHeaders to Imap.FetchMsgSet

Provides instructions for replacing deprecated FetchHeaders method calls with FetchMsgSet.

Chilkat Chilkat2-Python Downloads

Chilkat2-Python
import sys
import chilkat2

success = False

imap = chilkat2.Imap()

# ...
# ...

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

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

# bundleObj is a CkEmailBundle
bundleObj = imap.FetchHeaders(mset)
if (imap.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 = chilkat2.EmailBundle()
success = imap.FetchMsgSet(headersOnly,mset,bundleOut)
if (success == False):
    print(imap.LastErrorText)
    sys.exit()