Imap CkPython Reference Documentation
CkImap
Current Version: 11.5.0
Chilkat.Imap
Connect with SSL/TLS, STARTTLS, OAuth2, password authentication, proxy
settings, timeouts, and connection diagnostics.
List mailboxes, select folders, inspect mailbox state, and work with
server-side folders such as Inbox, Sent, Archive, or custom folders.
Search by IMAP criteria, work with UIDs or sequence numbers, download
full messages, headers, MIME, body text, or selected message parts.
Set and clear flags, mark messages read or unread, copy or move messages,
delete messages, expunge mailboxes, and append MIME to folders.
Retrieve email as Chilkat
Monitor mailbox changes with IMAP IDLE and use detailed logging,
response text, and
For an extended overview, see
Imap Class Overview.
Access, search, download, organize, and monitor email on IMAP servers.
Chilkat.Imap is a full-featured IMAP client class for
applications that need reliable server-side email access and mailbox
management. It supports secure connections, authentication, mailbox
selection, message searching, downloading email and attachments, flag
management, moving and copying messages, appending MIME, IDLE-based change
monitoring, and detailed diagnostics for troubleshooting server behavior.
Secure IMAP connections
Mailbox selection and listing
Search and fetch messages
Message management
Attachments and MIME
Email objects, process MIME
content, and save or inspect attachments as needed.
IDLE and diagnostics
LastErrorText to troubleshoot servers.
Object Creation
obj = chilkat.CkImap()
Properties
AbortCurrent
boolVal = imap.get_AbortCurrent();
imap.put_AbortCurrent(boolVal);
Controls cancellation of the method currently running on this Imap object.
- Set this property to
Trueto request that a long-running network operation abort. - Short methods that do not perform lengthy processing or network communication are generally unaffected.
- Both synchronous and asynchronous calls can be aborted. A synchronous call may be canceled by setting this property from another thread.
The property is automatically reset to False when the abort is processed. If no method is running, it is reset when the next method begins.
AppendSeen
boolVal = imap.get_AppendSeen();
imap.put_AppendSeen(boolVal);
Controls the initial \Seen flag when a message is appended to a mailbox.
True(the default): the appended message is marked as seen.False: the appended message is initially unseen.
This setting applies to append operations that do not explicitly supply message flags.
topAppendUid
intVal = imap.get_AppendUid();
Contains the UID assigned by the server to the message most recently added by an append method.
A value of 0 means the server did not return the appended message's UID. Not all IMAP servers support reporting this value.
AuthMethod
# ckStr is a CkString
imap.get_AuthMethod(ckStr);
strVal = imap.authMethod();
imap.put_AuthMethod(strVal);
Selects the IMAP authentication mechanism. The default is LOGIN, and an empty string also selects the default login behavior.
| Value | Purpose |
|---|---|
LOGIN | Username and password authentication. |
PLAIN | SASL PLAIN authentication. AuthzId may also be used. |
CRAM-MD5 | Challenge-response authentication when supported by the server. |
NTLM | Windows Integrated Authentication. |
XOAUTH2 | OAuth 2.0 access-token authentication. |
The selected mechanism must be supported by the IMAP server. If NTLM authentication fails because of an NTLM-version compatibility issue, set Global.DefaultNtlmVersion to 1 and retry.
AuthzId
# ckStr is a CkString
imap.get_AuthzId(ckStr);
strVal = imap.authzId();
imap.put_AuthzId(strVal);
Specifies the optional authorization identity used with the PLAIN authentication mechanism.
Leave this property empty unless the IMAP server requires an authorization identity that differs from the login identity supplied to Login.
AutoDownloadAttachments
boolVal = imap.get_AutoDownloadAttachments();
imap.put_AutoDownloadAttachments(boolVal);
Controls whether full-message fetch operations automatically include attachment data. The default is True.
True: attachments are downloaded with the message.False: the message is downloaded without ordinary attachment bodies, reducing transferred data.
Header-only methods ignore this property and never download attachment bodies. Related MIME parts used by an HTML body are still downloaded. Signed or encrypted messages are always downloaded in full because the complete MIME is required for verification or decryption.
AutoFix
boolVal = imap.get_AutoFix();
imap.put_AutoFix(boolVal);
When True (the default), adjusts the effective TLS settings when Connect is called for the standard IMAP ports:
- Port
993: uses implicit TLS by settingSsltoTrueandStartTlstoFalse. - Port
143: setsSsltoFalseso the connection begins as ordinary IMAP. Explicit TLS may still be requested withStartTls.
Set this property to False when the server uses nonstandard port and TLS combinations that must be controlled explicitly.
ClientIpAddress
# ckStr is a CkString
imap.get_ClientIpAddress(ckStr);
strVal = imap.clientIpAddress();
imap.put_ClientIpAddress(strVal);
Specifies the local IP address to bind when the computer has multiple network interfaces or addresses.
Leave this property empty for the usual case. The operating system will select the default local interface. When set, use a numeric IP address such as 165.164.55.124, not a hostname.
ConnectedToHost
# ckStr is a CkString
imap.get_ConnectedToHost(ckStr);
strVal = imap.connectedToHost();
Contains the hostname or IP address of the IMAP server to which the object is currently connected.
Returns an empty string when no connection is active.
topConnectTimeout
intVal = imap.get_ConnectTimeout();
imap.put_ConnectTimeout(intVal);
The maximum number of seconds to wait while establishing the TCP connection to the IMAP server.
The default is 30 seconds. This timeout applies to connection establishment, not to later reads from the server.
DebugLogFilePath
# ckStr is a CkString
imap.get_DebugLogFilePath(ckStr);
strVal = imap.debugLogFilePath();
imap.put_DebugLogFilePath(strVal);
If set to a file path, this property logs the LastErrorText of each Chilkat method or property call to the specified file. This logging helps identify the context and history of Chilkat calls leading up to any crash or hang, aiding in debugging.
Enabling the VerboseLogging property provides more detailed information. This property is mainly used for debugging rare instances where a Chilkat method call causes a hang or crash, which should generally not happen.
Possible causes of hangs include:
- A timeout property set to 0, indicating an infinite timeout.
- A hang occurring within an event callback in the application code.
- An internal bug in the Chilkat code causing the hang.
Domain
# ckStr is a CkString
imap.get_Domain(ckStr);
strVal = imap.domain();
imap.put_Domain(strVal);
Specifies the Windows domain used for NTLM authentication.
This property is optional and may be left empty when the login name already identifies the domain or when NTLM is not used.
topEnableSecrets
boolVal = imap.get_EnableSecrets();
imap.put_EnableSecrets(boolVal);
Enables automatic resolution of credential values from secure operating-system storage. The default is False.
When True, supported password arguments and properties may contain a secret specification beginning with !! instead of a literal secret. Chilkat resolves the value from Windows Credential Manager or Apple Keychain.
!![appName|]service[|domain]|username
This applies to HttpProxyPassword, SocksPassword, the password supplied to Login, and the password supplied to SshAuthenticatePw.
HighestModSeq
# ckStr is a CkString
imap.get_HighestModSeq(ckStr);
strVal = imap.highestModSeq();
Contains the HIGHESTMODSEQ value of the currently selected mailbox as a decimal string.
The value is 0 when no mailbox is selected or the server does not provide this information. A string is used because the value may exceed the integer range of some programming languages.
HttpProxyAuthMethod
# ckStr is a CkString
imap.get_HttpProxyAuthMethod(ckStr);
strVal = imap.httpProxyAuthMethod();
imap.put_HttpProxyAuthMethod(strVal);
Specifies the authentication mechanism used by an HTTP proxy.
Valid values are Basic and NTLM. This property is used only when HttpProxyHostname identifies an HTTP proxy that requires authentication.
HttpProxyDomain
# ckStr is a CkString
imap.get_HttpProxyDomain(ckStr);
strVal = imap.httpProxyDomain();
imap.put_HttpProxyDomain(strVal);
Specifies the optional Windows domain for HTTP-proxy NTLM authentication.
It is ignored when the proxy does not use NTLM authentication.
topHttpProxyHostname
# ckStr is a CkString
imap.get_HttpProxyHostname(ckStr);
strVal = imap.httpProxyHostname();
imap.put_HttpProxyHostname(strVal);
Specifies the hostname or numeric IPv4 address of an HTTP proxy through which the IMAP connection is established.
Leave this property empty to connect directly or to use another configured transport such as SOCKS or SSH tunneling.
topHttpProxyPassword
# ckStr is a CkString
imap.get_HttpProxyPassword(ckStr);
strVal = imap.httpProxyPassword();
imap.put_HttpProxyPassword(strVal);
Specifies the password used to authenticate with the configured HTTP proxy.
It is used only when the proxy requires authentication.
topHttpProxyPort
intVal = imap.get_HttpProxyPort();
imap.put_HttpProxyPort(intVal);
Specifies the TCP port of the configured HTTP proxy.
Common values include 8080 and 3128, but the correct value is determined by the proxy server configuration.
HttpProxyUsername
# ckStr is a CkString
imap.get_HttpProxyUsername(ckStr);
strVal = imap.httpProxyUsername();
imap.put_HttpProxyUsername(strVal);
Specifies the username used to authenticate with the configured HTTP proxy.
It is used only when the proxy requires authentication.
topKeepSessionLog
boolVal = imap.get_KeepSessionLog();
imap.put_KeepSessionLog(boolVal);
Enables or disables the in-memory IMAP protocol log. The default is False.
When enabled, SessionLog contains the raw commands sent to the server and the raw responses received. Use ClearSessionLog to reset it.
LastAppendedMime
# ckStr is a CkString
imap.get_LastAppendedMime(ckStr);
strVal = imap.lastAppendedMime();
Contains the MIME source most recently sent by AppendMail or AppendMime.
This is useful for diagnostics or for examining the exact MIME submitted to the server.
topLastCommand
# ckStr is a CkString
imap.get_LastCommand(ckStr);
strVal = imap.lastCommand();
Contains the most recent raw IMAP command sent to the server.
This property is primarily intended for diagnostics when an IMAP operation fails or produces an unexpected response.
topLastErrorHtml
# ckStr is a CkString
imap.get_LastErrorHtml(ckStr);
strVal = imap.lastErrorHtml();
Provides HTML-formatted information about the last called method or property. If a method call fails or behaves unexpectedly, check this property for details. Note that information is available regardless of the method call's success.
topLastErrorText
# ckStr is a CkString
imap.get_LastErrorText(ckStr);
strVal = imap.lastErrorText();
Provides plain text information about the last called method or property. If a method call fails or behaves unexpectedly, check this property for details. Note that information is available regardless of the method call's success.
LastErrorXml
# ckStr is a CkString
imap.get_LastErrorXml(ckStr);
strVal = imap.lastErrorXml();
Provides XML-formatted information about the last called method or property. If a method call fails or behaves unexpectedly, check this property for details. Note that information is available regardless of the method call's success.
topLastIntermediateResponse
# ckStr is a CkString
imap.get_LastIntermediateResponse(ckStr);
strVal = imap.lastIntermediateResponse();
Contains the most recent intermediate response received from the IMAP server while a command was in progress.
Use it for protocol-level diagnostics when a command involves continuations or multiple response stages.
topLastMethodSuccess
boolVal = imap.get_LastMethodSuccess();
imap.put_LastMethodSuccess(boolVal);
Indicates the success or failure of the most recent method call: True means success, False means failure. This property remains unchanged by property setters or getters. This method is present to address challenges in checking for null or Nothing returns in certain programming languages. Note: This property does not apply to methods that return integer values or to boolean-returning methods where the boolean does not indicate success or failure.
LastResponse
# ckStr is a CkString
imap.get_LastResponse(ckStr);
strVal = imap.lastResponse();
Contains the raw response received for the most recent IMAP command.
The property is cleared when a new command is sent. It remains empty if the server sends no response. Use it with LastResponseCode and LastCommand when troubleshooting server behavior.
LastResponseCode
# ckStr is a CkString
imap.get_LastResponseCode(ckStr);
strVal = imap.lastResponseCode();
Contains the optional IMAP response code from the most recent server response.
Response codes appear inside square brackets and provide information beyond the final OK, NO, or BAD result. Examples include NONEXISTENT, AUTHENTICATIONFAILED, and UIDVALIDITY. Exact values vary by server implementation.
LoggedInUser
# ckStr is a CkString
imap.get_LoggedInUser(ckStr);
strVal = imap.loggedInUser();
Contains the username of the authenticated IMAP session.
Returns an empty string when the object is not logged in.
topNumMessages
intVal = imap.get_NumMessages();
Contains the number of messages in the currently selected mailbox.
The value is updated by SelectMailbox and ExamineMailbox, and may also change when the server reports mailbox updates.
PeekMode
boolVal = imap.get_PeekMode();
imap.put_PeekMode(boolVal);
Controls whether fetching message content marks the message as seen.
False(the default): a fetch may set the\Seenflag.True: message data is fetched without setting\Seen, using IMAP peek semantics.
Port
intVal = imap.get_Port();
imap.put_Port(intVal);
Specifies the IMAP server port.
993is the standard port for implicit TLS and is normally used withSslset toTrue.143is the standard port for ordinary IMAP and for explicit TLS requested withStartTls.
When AutoFix is enabled, standard port values are used to adjust the effective TLS configuration when connecting.
PreferIpv6
boolVal = imap.get_PreferIpv6();
imap.put_PreferIpv6(boolVal);
Controls address-family preference when a hostname resolves to both IPv4 and IPv6 addresses.
False(the default): prefer IPv4.True: prefer IPv6.
The other address family may still be used when the preferred one is unavailable.
topReadTimeout
intVal = imap.get_ReadTimeout();
imap.put_ReadTimeout(intVal);
The maximum number of seconds that an incoming IMAP response may stall with no additional bytes received.
The default is 30 seconds. This is an inactivity timeout, not a limit on the total time allowed for a large response.
RequireSslCertVerify
boolVal = imap.get_RequireSslCertVerify();
imap.put_RequireSslCertVerify(boolVal);
Controls verification of the IMAP server's TLS certificate chain.
False(the default): a connection is not rejected solely because normal certificate-chain verification fails.True: the connection fails when the certificate is expired, its signature is invalid, or the chain cannot be trusted.
SearchCharset
# ckStr is a CkString
imap.get_SearchCharset(ckStr);
strVal = imap.searchCharset();
imap.put_SearchCharset(strVal);
Specifies the IMAP CHARSET used by Search and QueryMbx when search criteria contain non-ASCII characters. The default is UTF-8.
If the criteria contain only 7-bit ASCII characters, no CHARSET is needed and this property has no effect. The value AUTO enables the legacy behavior of selecting a charset by examining the criteria text.
Most applications should leave this property unchanged unless a particular server rejects non-English search text.
topSelectedMailbox
# ckStr is a CkString
imap.get_SelectedMailbox(ckStr);
strVal = imap.selectedMailbox();
Contains the name of the currently selected or examined mailbox.
Returns an empty string when no mailbox is selected.
topSendBufferSize
intVal = imap.get_SendBufferSize();
imap.put_SendBufferSize(intVal);
Specifies the application-level buffer size used when sending data through the underlying TCP connection.
The default is 32767 bytes. Most applications should leave this setting unchanged.
SeparatorChar
# ckStr is a CkString
imap.get_SeparatorChar(ckStr);
strVal = imap.separatorChar();
imap.put_SeparatorChar(strVal);
Contains the mailbox-hierarchy delimiter reported by the IMAP server, typically / or ..
MbxList and the legacy mailbox-listing methods update this property from the server's LIST response. The value is a string containing one character.
SessionLog
Contains the in-memory log of raw IMAP commands and server responses.
KeepSessionLog must be True for logging to occur. Call ClearSessionLog to remove previously collected entries.
SocksHostname
# ckStr is a CkString
imap.get_SocksHostname(ckStr);
strVal = imap.socksHostname();
imap.put_SocksHostname(strVal);
Specifies the hostname or numeric IP address of the SOCKS proxy.
This property is used only when SocksVersion is 4 or 5.
SocksPassword
# ckStr is a CkString
imap.get_SocksPassword(ckStr);
strVal = imap.socksPassword();
imap.put_SocksPassword(strVal);
Specifies the SOCKS5 proxy password.
It is ignored for SOCKS4 because SOCKS4 does not define password authentication.
topSocksPort
intVal = imap.get_SocksPort();
imap.put_SocksPort(intVal);
Specifies the SOCKS proxy port. The default is 1080.
This property is used only when SocksVersion is 4 or 5.
SocksUsername
# ckStr is a CkString
imap.get_SocksUsername(ckStr);
strVal = imap.socksUsername();
imap.put_SocksUsername(strVal);
Specifies the username sent to a SOCKS4 or SOCKS5 proxy.
This property is used only when SocksVersion is 4 or 5.
SocksVersion
intVal = imap.get_SocksVersion();
imap.put_SocksVersion(intVal);
Selects whether the IMAP connection uses a SOCKS proxy.
| Value | Behavior |
|---|---|
0 | Do not use a SOCKS proxy. This is the default. |
4 | Connect through a SOCKS4 proxy. |
5 | Connect through a SOCKS5 proxy. |
SoRcvBuf
intVal = imap.get_SoRcvBuf();
imap.put_SoRcvBuf(intVal);
Sets the operating system's TCP receive-buffer size. The default is 4194304 bytes.
Most applications should leave this unchanged. Increasing it may improve download throughput on high-latency or high-bandwidth networks. Values that are multiples of 4096 are recommended.
SortCriteria
# ckStr is a CkString
imap.get_SortCriteria(ckStr);
strVal = imap.sortCriteria();
imap.put_SortCriteria(strVal);
Specifies the server-side sort order used by QueryMbx. The default is an empty string, which performs an ordinary IMAP search without requesting sorting.
Provide space-separated sort keys. Sorting is ascending unless REVERSE appears immediately before a key.
ARRIVALCCDATEFROMSIZESUBJECTTO
Examples include SUBJECT REVERSE DATE, REVERSE SIZE, and ARRIVAL. The server must advertise the IMAP SORT capability.
SoSndBuf
intVal = imap.get_SoSndBuf();
imap.put_SoSndBuf(intVal);
Sets the operating system's TCP send-buffer size. The default is 262144 bytes.
Most applications should leave this unchanged. Increasing it may improve upload throughput; values such as 524288 or 1048576 may be tested when needed.
Ssl
boolVal = imap.get_Ssl();
imap.put_Ssl(boolVal);
Controls implicit TLS for the IMAP connection.
True: begin the connection with a TLS handshake, typically on port993.False: begin with ordinary IMAP. UseStartTlswhen the server requires an explicit STARTTLS upgrade.
SslAllowedCiphers
# ckStr is a CkString
imap.get_SslAllowedCiphers(ckStr);
strVal = imap.sslAllowedCiphers();
imap.put_SslAllowedCiphers(strVal);
Restricts the cipher suites and selected TLS security requirements offered for an IMAP TLS connection.
Leave this property empty to allow all cipher suites implemented by the installed Chilkat version. To restrict negotiation, provide a comma-separated list in preference order, for example:
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
The server chooses from the cipher suites offered by the client; the client cannot force a suite the server does not support.
The list may also contain these policy keywords:
rsa1024orrsa2048to require a minimum RSA server-key size.secure-renegotiationto require secure TLS renegotiation.best-practicesto use the security policy recommended by the installed Chilkat version.
Legacy keywords such as aes256-cbc, aes128-cbc, 3des-cbc, and rc4 remain recognized for compatibility, but explicitly listing acceptable suites is preferred.
SslProtocol
# ckStr is a CkString
imap.get_SslProtocol(ckStr);
strVal = imap.sslProtocol();
imap.put_SslProtocol(strVal);
Selects the TLS protocol version or minimum version allowed for secure IMAP connections.
Supported values include default, exact versions such as TLS 1.2 and TLS 1.3, and minimum-version forms such as TLS 1.2 or higher.
The default value is default, which lets Chilkat negotiate a protocol supported by both client and server. A minimum-version setting is generally more interoperable than requiring one exact version.
SslServerCertVerified
boolVal = imap.get_SslServerCertVerified();
Indicates whether the IMAP server's TLS certificate chain was successfully verified for the current or most recent TLS connection.
This property reports certificate-chain verification. A failed required verification prevents the connection from succeeding.
topStartTls
boolVal = imap.get_StartTls();
imap.put_StartTls(boolVal);
Controls explicit TLS using the IMAP STARTTLS command.
True: connect in clear text, issueSTARTTLS, and then continue through an encrypted channel.False: do not request an explicit TLS upgrade.
Explicit TLS is commonly used on port 143. For implicit TLS, set Ssl to True and normally use port 993.
TlsCipherSuite
# ckStr is a CkString
imap.get_TlsCipherSuite(ckStr);
strVal = imap.tlsCipherSuite();
Contains the cipher suite negotiated for the current or most recent TLS connection, for example TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384.
The value is empty before a TLS connection has been established or after a failed TLS negotiation.
topTlsPinSet
# ckStr is a CkString
imap.get_TlsPinSet(ckStr);
strVal = imap.tlsPinSet();
imap.put_TlsPinSet(strVal);
Specifies one or more expected SPKI fingerprints for TLS public-key pinning. The TLS handshake fails unless the server certificate matches at least one configured pin.
The format is:
hashAlgorithm, encoding, fingerprint1, fingerprint2, ...
Example:
sha256, base64, lKg1SIqyhPSK19tlPbjl8s02yChsVTDklQpkMCHvsTE=
Supported hash algorithms include sha1, sha256, sha384, sha512, md2, md5, haval, and the RIPEMD variants. Common encodings include base64 and hex.
TlsVersion
Contains the protocol version negotiated for the current or most recent TLS connection, such as TLS 1.2 or TLS 1.3.
The value is empty before a TLS connection has been established or after a failed TLS negotiation.
topUidNext
intVal = imap.get_UidNext();
Contains the mailbox's reported UIDNEXT value—the UID expected to be assigned to the next appended message.
The value is 0 when no mailbox is selected or when the server did not provide UIDNEXT.
UidValidity
intVal = imap.get_UidValidity();
Contains the UIDVALIDITY value of the currently selected mailbox, or 0 when no mailbox is selected.
An application that stores message UIDs should also store this value. If UIDVALIDITY changes in a later session, previously stored UIDs must no longer be assumed to identify the same messages.
UncommonOptions
# ckStr is a CkString
imap.get_UncommonOptions(ckStr);
strVal = imap.uncommonOptions();
imap.put_UncommonOptions(strVal);
Provides comma-separated compatibility or platform-specific options for uncommon cases. The default is an empty string, and most applications should leave it unchanged.
ProtectFromVpn: on Android, bypasses an installed or active VPN.EnableTls13: legacy option that enabled offering TLS 1.3 in versions where it was not yet enabled by default.
Utf8
boolVal = imap.get_Utf8();
imap.put_Utf8(boolVal);
When set to True, all string arguments and return values are interpreted as UTF-8 strings. When set to False, they are interpreted as ANSI strings.
In Chilkat v11.0.0 and later, the default value is True. Before v11.0.0, it was False.
VerboseLogging
boolVal = imap.get_VerboseLogging();
imap.put_VerboseLogging(boolVal);
If set to True, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. The default value is False. Verbose logging should only be used for debugging. The potentially large quantity of logged information may adversely affect peformance.
Version
Methods
AddPfxSourceBd
Adds the PKCS #12/PFX data in the BinData in bd as a source of certificates and private keys for S/MIME processing.
password contains the PFX password. Call this method once for each additional source.
Returns True for success, False for failure.
topAddPfxSourceFile
# pfxPassword is a string
status = imap.AddPfxSourceFile(pfxFilePath, pfxPassword);
Adds a PKCS #12/PFX file that may be searched for certificates and private keys needed for S/MIME decryption or signature processing.
pfxFilePath is the local filesystem path of the PFX file, and pfxPassword contains its password. Call this method once for each additional source.
On Windows, system certificate stores are also searched automatically. On macOS, the Keychain is searched automatically.
Returns True for success, False for failure.
topAppendMail
Appends the Email in email to the mailbox named by mailbox.
AppendSeen controls the initial \Seen flag unless flags are supplied by another append method. After a successful append, AppendUid contains the UID when the server reports it, and LastAppendedMime contains the MIME sent to the server.
Returns True for success, False for failure.
AppendMailAsync (1)
# mailbox is a string
# email is a CkEmail
ret_task = imap.AppendMailAsync(mailbox, email);
Creates an asynchronous task to call the AppendMail method with the arguments provided.
Returns None on failure
AppendMime
# mimeText is a string
status = imap.AppendMime(mailbox, mimeText);
Appends the MIME message in mimeText to the mailbox named by mailbox.
mimeText must contain a complete RFC 822/MIME message. After a successful append, AppendUid contains the UID when the server reports it, and LastAppendedMime contains the MIME sent.
Returns True for success, False for failure.
AppendMimeAsync (1)
# mailbox is a string
# mimeText is a string
ret_task = imap.AppendMimeAsync(mailbox, mimeText);
Creates an asynchronous task to call the AppendMime method with the arguments provided.
Returns None on failure
AppendMimeWithDateStr
# mimeText is a string
# internalDateStr is a string
status = imap.AppendMimeWithDateStr(mailbox, mimeText, internalDateStr);
Appends the MIME message in mimeText to the mailbox named by mailbox while explicitly setting the server-side internal date from internalDateStr.
internalDateStr is an RFC 822 date/time string, for example Fri, 10 Jul 2026 20:15:30 GMT. The internal date is mailbox metadata and is distinct from the message's Date header.
Returns True for success, False for failure.
topAppendMimeWithDateStrAsync (1)
# mailbox is a string
# mimeText is a string
# internalDateStr is a string
ret_task = imap.AppendMimeWithDateStrAsync(mailbox, mimeText, internalDateStr);
Creates an asynchronous task to call the AppendMimeWithDateStr method with the arguments provided.
Returns None on failure
AppendMimeWithFlags
# mimeText is a string
# seen is a boolean
# flagged is a boolean
# answered is a boolean
# draft is a boolean
status = imap.AppendMimeWithFlags(mailbox, mimeText, seen, flagged, answered, draft);
Appends the MIME message in mimeText to the mailbox named by mailbox and sets its initial system flags.
seencontrols\Seen.flaggedcontrols\Flagged.answeredcontrols\Answered.draftcontrols\Draft.
Use True to set a flag and False to leave it unset.
Returns True for success, False for failure.
topAppendMimeWithFlagsAsync (1)
# mailbox is a string
# mimeText is a string
# seen is a boolean
# flagged is a boolean
# answered is a boolean
# draft is a boolean
ret_task = imap.AppendMimeWithFlagsAsync(mailbox, mimeText, seen, flagged, answered, draft);
Creates an asynchronous task to call the AppendMimeWithFlags method with the arguments provided.
Returns None on failure
AppendMimeWithFlagsSb
# sbMime is a CkStringBuilder
# seen is a boolean
# flagged is a boolean
# answered is a boolean
# draft is a boolean
status = imap.AppendMimeWithFlagsSb(mailbox, sbMime, seen, flagged, answered, draft);
Appends the MIME contained in the StringBuilder in sbMime to mailbox mailbox and sets its initial flags.
seencontrols\Seen.flaggedcontrols\Flagged.answeredcontrols\Answered.draftcontrols\Draft.
Returns True for success, False for failure.
topAppendMimeWithFlagsSbAsync (1)
# mailbox is a string
# sbMime is a CkStringBuilder
# seen is a boolean
# flagged is a boolean
# answered is a boolean
# draft is a boolean
ret_task = imap.AppendMimeWithFlagsSbAsync(mailbox, sbMime, seen, flagged, answered, draft);
Creates an asynchronous task to call the AppendMimeWithFlagsSb method with the arguments provided.
Returns None on failure
Capability
Sends the IMAP CAPABILITY command and returns the server's raw capability response.
Use HasCapability to test the returned text for a particular capability such as IDLE, MOVE, SORT, or QUOTA.
Returns True for success, False for failure.
CapabilityAsync (1)
Creates an asynchronous task to call the Capability method with the arguments provided.
Returns None on failure
CheckConnection
Checks whether the underlying TCP socket is currently connected to the IMAP server.
This performs a low-level socket-state check and does not send an IMAP command. To verify that the server is responsive and the session remains usable, call Noop.
ClearSessionLog
Clears the in-memory text returned by SessionLog.
Session logging remains enabled or disabled according to KeepSessionLog.
CloseMailbox
status = imap.CloseMailbox(mailbox);
Closes the currently selected mailbox while keeping the IMAP connection and authenticated session open.
mailbox identifies the mailbox to close. In IMAP terminology, mailbox and folder refer to the same server-side container.
Returns True for success, False for failure.
topCloseMailboxAsync (1)
Creates an asynchronous task to call the CloseMailbox method with the arguments provided.
Returns None on failure
Connect
status = imap.Connect(domainName);
Establishes the TCP connection to the IMAP server identified by domainName but does not authenticate.
domainName may be a hostname, IPv4 address, or IPv6 address. Configure Port, Ssl, StartTls, proxy settings, and timeouts before calling this method. Call Login after the connection succeeds.
Connection failures can also be caused by DNS, local or remote firewalls, antivirus software, routing, or other network infrastructure outside Chilkat.
Returns True for success, False for failure.
ConnectAsync (1)
Creates an asynchronous task to call the Connect method with the arguments provided.
Returns None on failure
Copy
# bUid is a boolean
# copyToMailbox is a string
status = imap.Copy(msgId, bUid, copyToMailbox);
Copies one message from the currently selected mailbox to the destination mailbox in copyToMailbox.
msgId identifies the source message. If bUid is True, msgId is a UID; otherwise, msgId is a sequence number. The original message remains in the selected mailbox.
Returns True for success, False for failure.
CopyAsync (1)
# msgId is an integer
# bUid is a boolean
# copyToMailbox is a string
ret_task = imap.CopyAsync(msgId, bUid, copyToMailbox);
Creates an asynchronous task to call the Copy method with the arguments provided.
Returns None on failure
CopyMultiple
# copyToMailbox is a string
status = imap.CopyMultiple(messageSet, copyToMailbox);
Copies the messages identified by the MessageSet in messageSet from the selected mailbox to the destination mailbox in copyToMailbox.
The MessageSet.HasUids setting determines whether its values are UIDs or sequence numbers. The original messages remain in the selected mailbox.
Returns True for success, False for failure.
topCopyMultipleAsync (1)
# messageSet is a CkMessageSet
# copyToMailbox is a string
ret_task = imap.CopyMultipleAsync(messageSet, copyToMailbox);
Creates an asynchronous task to call the CopyMultiple method with the arguments provided.
Returns None on failure
CopySequence
# count is an integer
# copyToMailbox is a string
status = imap.CopySequence(startSeqNum, count, copyToMailbox);
Copies a contiguous range of messages, identified by sequence number, from the selected mailbox to the destination mailbox in copyToMailbox.
startSeqNum is the first sequence number and count is the number of messages to copy. IMAP sequence numbers begin at 1 and can change when messages are expunged.
Returns True for success, False for failure.
topCopySequenceAsync (1)
# startSeqNum is an integer
# count is an integer
# copyToMailbox is a string
ret_task = imap.CopySequenceAsync(startSeqNum, count, copyToMailbox);
Creates an asynchronous task to call the CopySequence method with the arguments provided.
Returns None on failure
CreateMailbox
status = imap.CreateMailbox(mailbox);
Creates the mailbox named by mailbox on the IMAP server.
Use the hierarchy delimiter reported in SeparatorChar when creating a nested mailbox. In IMAP terminology, mailbox and folder are synonymous.
Returns True for success, False for failure.
topCreateMailboxAsync (1)
Creates an asynchronous task to call the CreateMailbox method with the arguments provided.
Returns None on failure
DeleteMailbox
status = imap.DeleteMailbox(mailbox);
Deletes the mailbox named by mailbox from the IMAP server.
This deletes the mailbox itself, not merely the messages it contains. Server rules may require the mailbox to be empty first.
Returns True for success, False for failure.
topDeleteMailboxAsync (1)
Creates an asynchronous task to call the DeleteMailbox method with the arguments provided.
Returns None on failure
Disconnect
Closes the connection to the IMAP server.
A failure indicates that the connection could not be closed cleanly; the socket is nevertheless no longer intended for further use. In many applications, a disconnect failure during shutdown can be treated as nonfatal.
Returns True for success, False for failure.
topDisconnectAsync (1)
Creates an asynchronous task to call the Disconnect method with the arguments provided.
Returns None on failure
ExamineMailbox
status = imap.ExamineMailbox(mailbox);
Opens the mailbox in mailbox as read-only.
Use this instead of SelectMailbox when the application must not change message flags or mailbox state. Successful examination updates properties such as NumMessages, UidValidity, and UidNext.
Returns True for success, False for failure.
topExamineMailboxAsync (1)
Creates an asynchronous task to call the ExamineMailbox method with the arguments provided.
Returns None on failure
Expunge
Permanently removes all messages marked with the \Deleted flag from the currently selected mailbox.
Setting \Deleted alone does not remove message data; expunging commits those deletions and may change sequence numbers for the remaining messages.
Returns True for success, False for failure.
topExpungeAsync (1)
Creates an asynchronous task to call the Expunge method with the arguments provided.
Returns None on failure
ExpungeAndClose
Permanently removes all messages marked with \Deleted from the selected mailbox and then closes the mailbox.
The authenticated IMAP connection remains available after the mailbox is closed.
Returns True for success, False for failure.
topExpungeAndCloseAsync (1)
Creates an asynchronous task to call the ExpungeAndClose method with the arguments provided.
Returns None on failure
FetchAttachment
# attachmentIndex is an integer
# saveToPath is a string
status = imap.FetchAttachment(emailObject, attachmentIndex, saveToPath);
Obtains attachment attachmentIndex from the Email in emailObject and writes it to the local filesystem path in saveToPath. Attachment indexes are zero-based.
If emailObject already contains the attachment bytes, the data is saved locally without contacting the IMAP server. If emailObject was fetched without attachment bodies, Chilkat uses the IMAP metadata stored in its ckx-imap-* headers to download the requested attachment.
Related MIME parts used by an HTML body are not counted as ordinary attachments. Signed and encrypted messages are fetched in full because their complete MIME is required.
Returns True for success, False for failure.
topFetchAttachmentAsync (1)
# emailObject is a CkEmail
# attachmentIndex is an integer
# saveToPath is a string
ret_task = imap.FetchAttachmentAsync(emailObject, attachmentIndex, saveToPath);
Creates an asynchronous task to call the FetchAttachment method with the arguments provided.
Returns None on failure
FetchAttachmentBd
# attachmentIndex is an integer
# binData is a CkBinData
status = imap.FetchAttachmentBd(email, attachmentIndex, binData);
Obtains attachment attachmentIndex from the Email in email and stores its bytes in the BinData in binData.
Attachment indexes are zero-based. See FetchAttachment for details about fetching attachment data not already present in email.
Returns True for success, False for failure.
topFetchAttachmentBdAsync (1)
# email is a CkEmail
# attachmentIndex is an integer
# binData is a CkBinData
ret_task = imap.FetchAttachmentBdAsync(email, attachmentIndex, binData);
Creates an asynchronous task to call the FetchAttachmentBd method with the arguments provided.
Returns None on failure
FetchAttachmentSb
# attachmentIndex is an integer
# charset is a string
# sb is a CkStringBuilder
status = imap.FetchAttachmentSb(email, attachmentIndex, charset, sb);
Obtains text attachment attachmentIndex from the Email in email, decodes it using the charset in charset, and stores the text in the StringBuilder in sb.
Attachment indexes are zero-based. Use this only for text attachments. See FetchAttachment for details about fetching data not already present in email.
Returns True for success, False for failure.
topFetchAttachmentSbAsync (1)
# email is a CkEmail
# attachmentIndex is an integer
# charset is a string
# sb is a CkStringBuilder
ret_task = imap.FetchAttachmentSbAsync(email, attachmentIndex, charset, sb);
Creates an asynchronous task to call the FetchAttachmentSb method with the arguments provided.
Returns None on failure
FetchAttachmentString
# attachmentIndex is an integer
# charset is a string
# outStr is a CkString (output)
status = imap.FetchAttachmentString(emailObject, attachmentIndex, charset, outStr);
retStr = imap.fetchAttachmentString(emailObject, attachmentIndex, charset);
Obtains text attachment attachmentIndex from the Email in emailObject and decodes its bytes using the character encoding named by charset.
Use this only when the attachment contains text. Attachment indexes are zero-based. See FetchAttachment for information about downloading attachment data that is not already present in emailObject.
Returns True for success, False for failure.
topFetchAttachmentStringAsync (1)
# emailObject is a CkEmail
# attachmentIndex is an integer
# charset is a string
ret_task = imap.FetchAttachmentStringAsync(emailObject, attachmentIndex, charset);
Creates an asynchronous task to call the FetchAttachmentString method with the arguments provided.
Returns None on failure
FetchChunk2
# count is an integer
# failedSet is a CkMessageSet
# fetchedSet is a CkMessageSet
# bundle is a CkEmailBundle
status = imap.FetchChunk2(seqnum, count, failedSet, fetchedSet, bundle);
Downloads up to count full messages beginning with sequence number seqnum.
failedSet receives sequence numbers that failed, fetchedSet receives sequence numbers fetched successfully, and downloaded messages are appended to the EmailBundle in bundle.
IMAP sequence numbers begin at 1 and may change after an expunge.
Returns True for success, False for failure.
topFetchChunk2Async (1)
# seqnum is an integer
# count is an integer
# failedSet is a CkMessageSet
# fetchedSet is a CkMessageSet
# bundle is a CkEmailBundle
ret_task = imap.FetchChunk2Async(seqnum, count, failedSet, fetchedSet, bundle);
Creates an asynchronous task to call the FetchChunk2 method with the arguments provided.
Returns None on failure
FetchEmail
# msgId is an integer
# bUid is a boolean
# email is a CkEmail
status = imap.FetchEmail(headerOnly, msgId, bUid, email);
Downloads one message or its headers into the Email in email.
headerOnly=True: download headers only.headerOnly=False: download the full message.bUid=True:msgIdis a UID.bUid=False:msgIdis a sequence number.
For a full download, ordinary attachment bodies are included according to AutoDownloadAttachments.
Returns True for success, False for failure.
topFetchEmailAsync (1)
# headerOnly is a boolean
# msgId is an integer
# bUid is a boolean
# email is a CkEmail
ret_task = imap.FetchEmailAsync(headerOnly, msgId, bUid, email);
Creates an asynchronous task to call the FetchEmail method with the arguments provided.
Returns None on failure
FetchFlags
# bUid is a boolean
# outStrFlags is a CkString (output)
status = imap.FetchFlags(msgId, bUid, outStr);
retStr = imap.fetchFlags(msgId, bUid);
Returns the space-separated IMAP flags for the message identified by msgId.
If bUid is True, msgId is a UID; otherwise, it is a sequence number. A result might be \Flagged \Seen $label1.
An empty result may mean either that the message has no flags or that it does not exist. Examine LastResponse: a final OK indicates an existing message with no flags, while NO indicates that the message set was invalid.
Returns True for success, False for failure.
topFetchFlagsAsync (1)
# msgId is an integer
# bUid is a boolean
ret_task = imap.FetchFlagsAsync(msgId, bUid);
Creates an asynchronous task to call the FetchFlags method with the arguments provided.
Returns None on failure
FetchMsgSet
# msgSet is a CkMessageSet
# bundle is a CkEmailBundle
status = imap.FetchMsgSet(headersOnly, msgSet, bundle);
Downloads the messages identified by the MessageSet in msgSet and appends them to the EmailBundle in bundle.
headersOnly=True: download headers only.headersOnly=False: download full messages, with ordinary attachments controlled byAutoDownloadAttachments.
MessageSet.HasUids determines whether msgSet contains UIDs or sequence numbers. bundle is not cleared before results are added.
Returns True for success, False for failure.
topFetchMsgSetAsync (1)
# headersOnly is a boolean
# msgSet is a CkMessageSet
# bundle is a CkEmailBundle
ret_task = imap.FetchMsgSetAsync(headersOnly, msgSet, bundle);
Creates an asynchronous task to call the FetchMsgSet method with the arguments provided.
Returns None on failure
FetchRange
# seqnum is an integer
# count is an integer
# bundle is a CkEmailBundle
status = imap.FetchRange(headersOnly, seqnum, count, bundle);
Downloads count messages beginning with sequence number seqnum and appends them to the EmailBundle in bundle.
headersOnly=True: download headers only.headersOnly=False: download full messages.
IMAP sequence numbers begin at 1; passing 0 for seqnum fails. Sequence numbers can change after messages are expunged.
Returns True for success, False for failure.
topFetchRangeAsync (1)
# headersOnly is a boolean
# seqnum is an integer
# count is an integer
# bundle is a CkEmailBundle
ret_task = imap.FetchRangeAsync(headersOnly, seqnum, count, bundle);
Creates an asynchronous task to call the FetchRange method with the arguments provided.
Returns None on failure
FetchSingleAsMime
# bUid is a boolean
# outStrMime is a CkString (output)
status = imap.FetchSingleAsMime(msgId, bUid, outStr);
retStr = imap.fetchSingleAsMime(msgId, bUid);
Downloads one message and returns its MIME source as a string.
If bUid is True, msgId is a UID; otherwise, msgId is a sequence number. Ordinary attachment bodies are included according to AutoDownloadAttachments.
Use FetchSingleBd when the MIME must be preserved as binary data.
Returns True for success, False for failure.
FetchSingleAsMimeAsync (1)
# msgId is an integer
# bUid is a boolean
ret_task = imap.FetchSingleAsMimeAsync(msgId, bUid);
Creates an asynchronous task to call the FetchSingleAsMime method with the arguments provided.
Returns None on failure
FetchSingleAsMimeSb
# bUid is a boolean
# sbMime is a CkStringBuilder
status = imap.FetchSingleAsMimeSb(msgId, bUid, sbMime);
Downloads one message's MIME into the StringBuilder in sbMime.
If bUid is True, msgId is a UID; otherwise, it is a sequence number. Ordinary attachment bodies are included according to AutoDownloadAttachments.
Returns True for success, False for failure.
topFetchSingleAsMimeSbAsync (1)
# msgId is an integer
# bUid is a boolean
# sbMime is a CkStringBuilder
ret_task = imap.FetchSingleAsMimeSbAsync(msgId, bUid, sbMime);
Creates an asynchronous task to call the FetchSingleAsMimeSb method with the arguments provided.
Returns None on failure
FetchSingleBd
# bUid is a boolean
# mimeData is a CkBinData
status = imap.FetchSingleBd(msgId, bUid, mimeData);
Downloads one message's MIME bytes into the BinData in mimeData.
If bUid is True, msgId is a UID; otherwise, it is a sequence number. Ordinary attachment bodies are included according to AutoDownloadAttachments.
Use this method when the exact MIME bytes must be preserved.
Returns True for success, False for failure.
FetchSingleBdAsync (1)
# msgId is an integer
# bUid is a boolean
# mimeData is a CkBinData
ret_task = imap.FetchSingleBdAsync(msgId, bUid, mimeData);
Creates an asynchronous task to call the FetchSingleBd method with the arguments provided.
Returns None on failure
FetchSingleHeaderAsMime
# bUID is a boolean
# outStr is a CkString (output)
status = imap.FetchSingleHeaderAsMime(msgId, bUID, outStr);
retStr = imap.fetchSingleHeaderAsMime(msgId, bUID);
Downloads and returns the MIME header block for one message, without downloading the body.
If bUID is True, msgId is a UID; otherwise, msgId is a sequence number.
Returns True for success, False for failure.
topFetchSingleHeaderAsMimeAsync (1)
# msgId is an integer
# bUID is a boolean
ret_task = imap.FetchSingleHeaderAsMimeAsync(msgId, bUID);
Creates an asynchronous task to call the FetchSingleHeaderAsMime method with the arguments provided.
Returns None on failure
GetMailAttachFilename
# attachIndex is an integer
# outStrFilename is a CkString (output)
status = imap.GetMailAttachFilename(email, attachIndex, outStr);
retStr = imap.getMailAttachFilename(email, attachIndex);
Returns the filename of attachment attachIndex described by the Email in email.
Attachment indexes are zero-based. This method can read attachment metadata from a header-only email even when the attachment body was not downloaded.
Returns True for success, False for failure.
GetMailAttachSize
# attachIndex is an integer
retInt = imap.GetMailAttachSize(email, attachIndex);
Returns the size, in bytes, of attachment attachIndex described by the Email in email.
Attachment indexes are zero-based. This method can read attachment metadata from a header-only email.
GetMailboxStatus
# outStr is a CkString (output)
status = imap.GetMailboxStatus(mailbox, outStr);
retStr = imap.getMailboxStatus(mailbox);
Sends the IMAP STATUS command for the mailbox in mailbox and returns the reported values as XML attributes.
messages: total number of messages.recent: messages having the\Recentflag.uidnext: expected UID for the next appended message.uidvalidity: mailbox UID-validity value.unseen: messages without the\Seenflag.
<status messages="240" recent="0" uidnext="3674" uidvalidity="3" unseen="213" />
Returns True for success, False for failure.
topGetMailboxStatusAsync (1)
Creates an asynchronous task to call the GetMailboxStatus method with the arguments provided.
Returns None on failure
GetMailFlag
Returns 1 when the flag named by flagName is set on the Email in email, and 0 when it is not set.
Standard flags include \Seen, \Answered, \Flagged, \Draft, and \Deleted. Custom keywords such as $label1 or NonJunk are also supported.
The value is read from IMAP metadata stored in the email's ckx-* headers.
GetMailNumAttach
Returns the number of ordinary attachments described by the Email in email.
The count can be obtained from a header-only email because Chilkat stores attachment metadata in internal IMAP header fields. Related MIME parts are not counted as ordinary attachments.
GetMailSize
Returns the complete server-reported size of the Email in email, in bytes, including attachment data.
This value may be available even when only the message headers were downloaded.
GetQuota
# outStr is a CkString (output)
status = imap.GetQuota(quotaRoot, outStr);
retStr = imap.getQuota(quotaRoot);
Sends the IMAP GETQUOTA command for the quota root in quotaRoot and returns the server response as JSON.
The server must advertise the IMAP QUOTA capability.
Returns True for success, False for failure.
GetQuotaAsync (1)
Creates an asynchronous task to call the GetQuota method with the arguments provided.
Returns None on failure
GetQuotaRoot
# outStr is a CkString (output)
status = imap.GetQuotaRoot(mailboxName, outStr);
retStr = imap.getQuotaRoot(mailboxName);
Sends the IMAP GETQUOTAROOT command for the mailbox in mailboxName and returns the server response as JSON.
The server must advertise the IMAP QUOTA capability.
Returns True for success, False for failure.
GetQuotaRootAsync (1)
Creates an asynchronous task to call the GetQuotaRoot method with the arguments provided.
Returns None on failure
GetServerCert
Stores the certificate presented by the IMAP server for the current or most recent TLS connection in the Cert object supplied as cert.
This is useful for certificate inspection, diagnostics, or implementing application-specific trust checks.
Returns True for success, False for failure.
topHasCapability
# capabilityResponse is a string
retBool = imap.HasCapability(name, capabilityResponse);
Tests whether the capability named by name appears in the raw capability response in capabilityResponse.
capabilityResponse is typically the string returned by Capability. Capability-name matching follows IMAP capability-token semantics.
IdleCheck
# outStr is a CkString (output)
status = imap.IdleCheck(timeoutMs, outStr);
retStr = imap.idleCheck(timeoutMs);
Waits up to timeoutMs milliseconds for unsolicited mailbox updates after IdleStart has entered IMAP IDLE mode.
This method does not send a polling command. It reads notifications that the server has already sent over the existing connection and returns them as XML.
flags: flags changed for a message.expunge: a sequence number was removed.exists: the mailbox message count changed.recent: the recent-message count changed.raw: an unrecognized response line retained for diagnostics.
<idle>
<flags seqnum="59" uid="11876">
<flag>\Deleted</flag>
<flag>\Seen</flag>
</flags>
<expunge>58</expunge>
<exists>115</exists>
<recent>0</recent>
</idle>
When no update is available, the result is <idle></idle>. Call this method frequently while IDLE is active, and call IdleDone before issuing another IMAP command.
Returns True for success, False for failure.
IdleCheckAsync (1)
Creates an asynchronous task to call the IdleCheck method with the arguments provided.
Returns None on failure
IdleDone
Ends IMAP IDLE mode by sending the protocol's DONE continuation.
Call this before sending another IMAP command on the same connection.
Returns True for success, False for failure.
IdleDoneAsync (1)
Creates an asynchronous task to call the IdleDone method with the arguments provided.
Returns None on failure
IdleStart
Sends the IMAP IDLE command and begins listening for unsolicited mailbox updates.
The server must advertise the IDLE capability. After this succeeds, call IdleCheck to receive updates and IdleDone to leave IDLE mode.
Returns True for success, False for failure.
IdleStartAsync (1)
Creates an asynchronous task to call the IdleStart method with the arguments provided.
Returns None on failure
IsConnected
Returns the last known connection state without sending data to the IMAP server.
A True result does not prove that an idle connection is still usable. Call Noop to send a command and verify that the server responds.
IsLoggedIn
Indicates whether this object is in an authenticated IMAP session.
This reports the last known state and does not send a command to the server.
topLoadTaskCaller
Associates this Imap object with the original Imap caller that created the asynchronous Task in task.
This works with a task returned by any Imap async method, and the task does not need to be complete. The operation does not copy the caller's state; this object becomes another reference to the same underlying Imap state. Any previously associated state in this object is replaced.
Use this when code has a Task—for example in a task-completed callback—but no longer has a reference to the object that started the async operation.
Returns True for success, False for failure.
topLogin
# password is a string
status = imap.Login(loginName, password);
Authenticates the connected IMAP session using the login name in loginName and the credential in password.
Call Connect first. The mechanism is selected by AuthMethod. For XOAUTH2, password is the OAuth 2.0 access token rather than a password.
Returns True for success, False for failure.
LoginAsync (1)
# loginName is a string
# password is a string
ret_task = imap.LoginAsync(loginName, password);
Creates an asynchronous task to call the Login method with the arguments provided.
Returns None on failure
LoginSecure
# password is a CkSecureString
status = imap.LoginSecure(loginName, password);
Authenticates the connected IMAP session using the SecureString login name in loginName and credential in password.
This is the secure-string counterpart of Login. The authentication mechanism is selected by AuthMethod.
Returns True for success, False for failure.
LoginSecureAsync (1)
# loginName is a CkSecureString
# password is a CkSecureString
ret_task = imap.LoginSecureAsync(loginName, password);
Creates an asynchronous task to call the LoginSecure method with the arguments provided.
Returns None on failure
Logout
Sends the IMAP LOGOUT command and ends the authenticated session.
The server normally closes the connection as part of a successful logout.
Returns True for success, False for failure.
topLogoutAsync (1)
Creates an asynchronous task to call the Logout method with the arguments provided.
Returns None on failure
MbxList
# reference is a string
# mbxPattern is a string
# mboxes is a CkMailboxes
status = imap.MbxList(subscribed, reference, mbxPattern, mboxes);
Lists mailboxes into the Mailboxes object in mboxes.
subscribed=True: list only subscribed mailboxes.subscribed=False: list all matching mailboxes.
reference is the IMAP reference name, usually an empty string. mbxPattern is the mailbox pattern: * matches zero or more hierarchy levels, while % matches one hierarchy level.
Examples:
reference="",mbxPattern=*: all visible mailboxes.reference="",mbxPattern=%: top-level mailboxes.reference=INBOX.,mbxPattern=*: descendants underINBOX.on a server using.as its delimiter.
The method also updates SeparatorChar from the server's response.
Returns True for success, False for failure.
topMbxListAsync (1)
# subscribed is a boolean
# reference is a string
# mbxPattern is a string
# mboxes is a CkMailboxes
ret_task = imap.MbxListAsync(subscribed, reference, mbxPattern, mboxes);
Creates an asynchronous task to call the MbxList method with the arguments provided.
Returns None on failure
MoveMessages
# destFolder is a string
status = imap.MoveMessages(messageSet, destFolder);
Moves the messages identified by the MessageSet in messageSet from the selected mailbox to destination mailbox destFolder.
The server must advertise the IMAP MOVE capability. MessageSet.HasUids determines whether messageSet contains UIDs or sequence numbers.
Returns True for success, False for failure.
MoveMessagesAsync (1)
# messageSet is a CkMessageSet
# destFolder is a string
ret_task = imap.MoveMessagesAsync(messageSet, destFolder);
Creates an asynchronous task to call the MoveMessages method with the arguments provided.
Returns None on failure
Noop
Sends the IMAP NOOP command and waits for the server response.
This is useful for verifying that an existing authenticated connection is still responsive and for receiving unsolicited mailbox-state updates.
Returns True for success, False for failure.
topNoopAsync (1)
Creates an asynchronous task to call the Noop method with the arguments provided.
Returns None on failure
QueryMbx
# bUid is a boolean
# msgSet is a CkMessageSet
status = imap.QueryMbx(criteria, bUid, msgSet);
Searches the selected mailbox using the IMAP criteria in criteria and stores matching identifiers in the MessageSet in msgSet.
If bUid is True, msgSet contains UIDs; otherwise, it contains sequence numbers. SearchCharset applies when the criteria contain non-ASCII text.
The special criterion new-email finds messages received since the mailbox was selected or since the previous new-email query. It closes and reopens the mailbox and returns UIDs for recent messages or messages beyond the previously observed UIDNEXT.
When SortCriteria is nonempty, the method sends IMAP SORT instead of SEARCH. The server must advertise the corresponding capability.
Returns True for success, False for failure.
QueryMbxAsync (1)
# criteria is a string
# bUid is a boolean
# msgSet is a CkMessageSet
ret_task = imap.QueryMbxAsync(criteria, bUid, msgSet);
Creates an asynchronous task to call the QueryMbx method with the arguments provided.
Returns None on failure
QueryThread
# searchCriteria is a string
# bUid is a boolean
# json is a CkJsonObject
status = imap.QueryThread(threadAlg, searchCriteria, bUid, json);
Sends the IMAP THREAD command for the selected mailbox and stores the thread hierarchy in the JsonObject in json.
threadAlg is the threading algorithm, commonly ORDEREDSUBJECT or REFERENCES. searchCriteria contains ordinary IMAP search criteria. If bUid is True, message identifiers in the result are UIDs; otherwise, they are sequence numbers.
The server must advertise the IMAP THREAD capability and support the selected algorithm. ORDEREDSUBJECT groups messages by normalized subject and date; REFERENCES builds parent-child relationships from message-reference headers and reply subjects.
Returns True for success, False for failure.
topQueryThreadAsync (1)
# threadAlg is a string
# searchCriteria is a string
# bUid is a boolean
# json is a CkJsonObject
ret_task = imap.QueryThreadAsync(threadAlg, searchCriteria, bUid, json);
Creates an asynchronous task to call the QueryThread method with the arguments provided.
Returns None on failure
RawCommandBd
Sends the raw IMAP command bytes in the BinData in bdCmd and stores the raw response bytes in bdResp.
Use this for protocol extensions or binary command data that cannot be represented safely as text. The caller is responsible for valid IMAP syntax and session state.
Returns True for success, False for failure.
topRawCommandBdAsync (1)
# bdCmd is a CkBinData
# bdResp is a CkBinData
ret_task = imap.RawCommandBdAsync(bdCmd, bdResp);
Creates an asynchronous task to call the RawCommandBd method with the arguments provided.
Returns None on failure
RefetchMailFlags
Fetches the current IMAP flags for the message represented by email and updates the email's internal ckx-* metadata headers.
Methods such as GetMailFlag read these stored headers. email must contain the IMAP identifiers added when the email was originally fetched.
Returns True for success, False for failure.
topRefetchMailFlagsAsync (1)
Creates an asynchronous task to call the RefetchMailFlags method with the arguments provided.
Returns None on failure
RenameMailbox
# toMailbox is a string
status = imap.RenameMailbox(fromMailbox, toMailbox);
Renames the mailbox in fromMailbox to the name in toMailbox.
Changing hierarchy components can also move a mailbox within the server's folder tree, for example from INBOX.old.project to INBOX.archive.project.
Returns True for success, False for failure.
topRenameMailboxAsync (1)
# fromMailbox is a string
# toMailbox is a string
ret_task = imap.RenameMailboxAsync(fromMailbox, toMailbox);
Creates an asynchronous task to call the RenameMailbox method with the arguments provided.
Returns None on failure
SelectMailbox
status = imap.SelectMailbox(mailbox);
Opens the mailbox in mailbox for read-write access.
A mailbox must be selected before message fetch, search, flag, copy, move, or expunge operations that act on mailbox contents. Successful selection updates SelectedMailbox, NumMessages, UidValidity, and related mailbox-state properties.
Use ExamineMailbox when read-only access is required.
Returns True for success, False for failure.
SelectMailboxAsync (1)
Creates an asynchronous task to call the SelectMailbox method with the arguments provided.
Returns None on failure
SendRawCommand
# outRawResponse is a CkString (output)
status = imap.SendRawCommand(cmd, outStr);
retStr = imap.sendRawCommand(cmd);
Sends the raw IMAP command text in cmd and returns the raw server response.
Use this only for protocol extensions or commands not otherwise exposed by the API. The caller is responsible for correct IMAP syntax and for maintaining a valid connection, authentication, selected-mailbox, and IDLE state.
Returns True for success, False for failure.
SendRawCommandAsync (1)
Creates an asynchronous task to call the SendRawCommand method with the arguments provided.
Returns None on failure
SetDecryptCert
Specifies the Cert in cert for decrypting S/MIME messages downloaded by this Imap object.
The certificate must have access to its associated private key. Use SetDecryptCert2 when the private key is supplied separately.
Returns True for success, False for failure.
topSetDecryptCert2
Specifies the certificate in cert and its separately supplied PrivateKey in key for decrypting S/MIME messages.
Use this when the certificate object does not already provide access to the private key.
Returns True for success, False for failure.
topSetFlag
# bUid is a boolean
# flagName is a string
# value is an integer
status = imap.SetFlag(msgId, bUid, flagName, value);
Sets or clears one flag on the message identified by msgId in the selected mailbox.
If bUid is True, msgId is a UID; otherwise, it is a sequence number. flagName is the flag name, and value is 1 to set the flag or 0 to clear it.
Standard flags include \Deleted, \Seen, \Answered, \Flagged, and \Draft. Server-supported custom keywords may also be used.
Returns True for success, False for failure.
SetFlagAsync (1)
# msgId is an integer
# bUid is a boolean
# flagName is a string
# value is an integer
ret_task = imap.SetFlagAsync(msgId, bUid, flagName, value);
Creates an asynchronous task to call the SetFlag method with the arguments provided.
Returns None on failure
SetFlags
# flagName is a string
# value is an integer
status = imap.SetFlags(messageSet, flagName, value);
Sets or clears one flag for every message in the MessageSet supplied in messageSet.
flagName is the flag name, and value is 1 to set the flag or 0 to clear it. MessageSet.HasUids determines whether the identifiers are UIDs or sequence numbers.
Returns True for success, False for failure.
topSetFlagsAsync (1)
# messageSet is a CkMessageSet
# flagName is a string
# value is an integer
ret_task = imap.SetFlagsAsync(messageSet, flagName, value);
Creates an asynchronous task to call the SetFlags method with the arguments provided.
Returns None on failure
SetMailFlag
# flagName is a string
# value is an integer
status = imap.SetMailFlag(email, flagName, value);
Sets or clears a flag for the server message represented by the Email in email.
Chilkat obtains the UID from the email's ckx-imap-uid header. flagName is the flag name, and value is 1 to set it or 0 to clear it. The method fails if the required UID metadata is absent.
Setting \Deleted marks the message for deletion; call Expunge to remove it permanently.
Returns True for success, False for failure.
topSetMailFlagAsync (1)
# email is a CkEmail
# flagName is a string
# value is an integer
ret_task = imap.SetMailFlagAsync(email, flagName, value);
Creates an asynchronous task to call the SetMailFlag method with the arguments provided.
Returns None on failure
SetQuota
# resource is a string
# quota is an integer
retBool = imap.SetQuota(quotaRoot, resource, quota);
Sends the IMAP SETQUOTA command for quota root quotaRoot.
resource is STORAGE to set the combined message-storage limit or MESSAGE to set the message-count limit. For STORAGE, quota is measured in units of 1024 octets; for example, 500000 represents approximately 500,000,000 bytes.
The server must support the IMAP QUOTA extension and the requested resource type.
SetQuotaAsync (1)
# quotaRoot is a string
# resource is a string
# quota is an integer
ret_task = imap.SetQuotaAsync(quotaRoot, resource, quota);
Creates an asynchronous task to call the SetQuota method with the arguments provided.
Returns None on failure
SetSslClientCert
Specifies the client certificate in cert for TLS client-certificate authentication.
Most IMAP servers do not require a client certificate. When one is required, cert must provide access to the corresponding private key.
Returns True for success, False for failure.
topSetSslClientCertPem
# pemPassword is a string
status = imap.SetSslClientCertPem(pemDataOrFilename, pemPassword);
Specifies a TLS client certificate and private key from PEM data or a PEM file.
pemDataOrFilename may contain the PEM text itself or a local filesystem path to the PEM file; Chilkat detects which form was supplied. pemPassword contains the password when the private key is encrypted.
Returns True for success, False for failure.
SetSslClientCertPfx
# pfxPassword is a string
status = imap.SetSslClientCertPfx(pfxFilename, pfxPassword);
Specifies a TLS client certificate and private key from a PKCS #12/PFX file.
pfxFilename is the local filesystem path of the .pfx or .p12 file, and pfxPassword contains its password.
Returns True for success, False for failure.
topSshAuthenticatePk
# privateKey is a CkSshKey
status = imap.SshAuthenticatePk(sshLogin, privateKey);
Authenticates the SSH tunnel using the username in sshLogin and the SshKey private key in privateKey.
Call SshOpenTunnel first. The corresponding public key must already be authorized for sshLogin on the SSH server. After authentication, call Connect and Login for the IMAP server.
Returns True for success, False for failure.
topSshAuthenticatePkAsync (1)
# sshLogin is a string
# privateKey is a CkSshKey
ret_task = imap.SshAuthenticatePkAsync(sshLogin, privateKey);
Creates an asynchronous task to call the SshAuthenticatePk method with the arguments provided.
Returns None on failure
SshAuthenticatePw
# sshPassword is a string
status = imap.SshAuthenticatePw(sshLogin, sshPassword);
Authenticates the SSH tunnel using the username in sshLogin and password in sshPassword.
Call SshOpenTunnel first. After SSH authentication succeeds, call Connect and Login; the IMAP traffic then flows through the tunnel automatically.
Returns True for success, False for failure.
SshAuthenticatePwAsync (1)
# sshLogin is a string
# sshPassword is a string
ret_task = imap.SshAuthenticatePwAsync(sshLogin, sshPassword);
Creates an asynchronous task to call the SshAuthenticatePw method with the arguments provided.
Returns None on failure
SshCloseTunnel
Closes the SSH tunnel opened by SshOpenTunnel.
Any IMAP connection using that tunnel must no longer be used after the tunnel is closed.
Returns True for success, False for failure.
topSshCloseTunnelAsync (1)
Creates an asynchronous task to call the SshCloseTunnel method with the arguments provided.
Returns None on failure
SshOpenTunnel
# sshPort is an integer
status = imap.SshOpenTunnel(sshHostname, sshPort);
Connects to the SSH server in sshHostname on port sshPort and prepares an SSH tunnel for the later IMAP connection.
Port 22 is the usual SSH port. After this succeeds, authenticate with SshAuthenticatePw or SshAuthenticatePk, then call Connect and Login for IMAP.
Returns True for success, False for failure.
SshOpenTunnelAsync (1)
# sshHostname is a string
# sshPort is an integer
ret_task = imap.SshOpenTunnelAsync(sshHostname, sshPort);
Creates an asynchronous task to call the SshOpenTunnel method with the arguments provided.
Returns None on failure
StoreFlags
# bUid is a boolean
# flagNames is a string
# value is an integer
status = imap.StoreFlags(msgId, bUid, flagNames, value);
Sets or clears multiple flags on one message in the selected mailbox.
If bUid is True, msgId is a UID; otherwise, it is a sequence number. flagNames is a space-separated list such as \Seen \Answered $label1. value is 1 to set all listed flags or 0 to clear them.
Returns True for success, False for failure.
topStoreFlagsAsync (1)
# msgId is an integer
# bUid is a boolean
# flagNames is a string
# value is an integer
ret_task = imap.StoreFlagsAsync(msgId, bUid, flagNames, value);
Creates an asynchronous task to call the StoreFlags method with the arguments provided.
Returns None on failure
Subscribe
status = imap.Subscribe(mailbox);
Subscribes the authenticated IMAP account to the mailbox named by mailbox.
Subscription controls which mailboxes are returned by subscribed-mailbox listing operations; it does not create the mailbox.
Returns True for success, False for failure.
SubscribeAsync (1)
Creates an asynchronous task to call the Subscribe method with the arguments provided.
Returns None on failure
Unsubscribe
status = imap.Unsubscribe(mailbox);
Removes the subscription to the mailbox named by mailbox.
The mailbox itself and its messages are not deleted.
Returns True for success, False for failure.
UnsubscribeAsync (1)
Creates an asynchronous task to call the Unsubscribe method with the arguments provided.
Returns None on failure
UseCertVault
Associates the XmlCertVault in vault with this Imap object as a source of certificates and private keys for S/MIME operations.
Only one vault can be associated at a time. Calling this method again replaces the previously associated vault.
Returns True for success, False for failure.
topUseSsh
Uses an already connected and authenticated Ssh object as the transport for subsequent IMAP connections.
SSH supports multiple logical channels, so the same SSH connection may be shared by IMAP and other Chilkat objects. Call this method before Connect.
Returns True for success, False for failure.
UseSshTunnel
Uses the existing SSH tunnel represented by the Socket in tunnel for subsequent IMAP connections.
This allows a tunnel to be shared with other objects. Call this method before Connect.
Returns True for success, False for failure.
Deprecated
AddPfxSourceData Deprecated
# pfxPassword is a string
status = imap.AddPfxSourceData(pfxBytes, pfxPassword);
Adds a PKCS #12/PFX source that may be searched for certificates and private keys needed for S/MIME decryption or signature processing.
pfxBytes contains the PFX bytes, and pfxPassword contains its password. Call this method once for each additional source. Common file extensions are .pfx and .p12.
Returns True for success, False for failure.
topCheckForNewEmail
Deprecated: Use QueryMbx instead.
Checks for messages that arrived since the mailbox was selected or since the previous call to this method, whichever is later.
The method closes and reopens the selected mailbox, then searches for messages marked recent or having a UID greater than the prior UIDNEXT. The returned MessageSet contains UIDs and may be passed to FetchMsgSet.
Returns None on failure
CheckForNewEmailAsync (1) (2)
Creates an asynchronous task to call the CheckForNewEmail method with the arguments provided.
Returns None on failure
FetchAttachmentBytes Deprecated
# attachIndex is an integer
# outBytes is a CkByteData (output)
status = imap.FetchAttachmentBytes(email, attachIndex, outData);
Obtains attachment attachIndex from the Email in email and returns its bytes. Attachment indexes are zero-based.
If the attachment is not already present in email, Chilkat downloads it from the IMAP server using the message metadata stored in the email. See FetchAttachment for attachment-fetching details.
Returns True for success, False for failure.
topFetchAttachmentBytesAsync Deprecated (1)
# email is a CkEmail
# attachIndex is an integer
ret_task = imap.FetchAttachmentBytesAsync(email, attachIndex);
Creates an asynchronous task to call the FetchAttachmentBytes method with the arguments provided.
Returns None on failure
FetchBundle
# messageSet is a CkMessageSet
ret_emailBundle = imap.FetchBundle(messageSet);
Deprecated: Use FetchMsgSet instead.
Downloads the messages identified by the MessageSet in messageSet and returns them in an EmailBundle.
Whether messageSet contains UIDs or sequence numbers is determined by its HasUids property.
Returns None on failure
FetchBundleAsync (1) (2)
Creates an asynchronous task to call the FetchBundle method with the arguments provided.
Returns None on failure
FetchBundleAsMime
# messageSet is a CkMessageSet
ret_stringArray = imap.FetchBundleAsMime(messageSet);
Deprecated: Use FetchSingleBd or methods that return Email objects.
Downloads the messages identified by messageSet and returns their MIME sources in a StringArray. MIME may contain binary data and mixed character encodings, so representing it as ordinary strings can require transformations and is not suitable for preserving exact bytes.
Returns None on failure
FetchBundleAsMimeAsync (1) (2)
# messageSet is a CkMessageSet
ret_task = imap.FetchBundleAsMimeAsync(messageSet);
Creates an asynchronous task to call the FetchBundleAsMime method with the arguments provided.
Returns None on failure
FetchChunk
# count is an integer
# failedSet is a CkMessageSet
# fetchedSet is a CkMessageSet
status = imap.FetchChunk(startSeqNum, count, failedSet, fetchedSet);
Deprecated: Use FetchRange instead.
Downloads a sequence-number range beginning at startSeqNum and containing up to count messages.
failedSet receives sequence numbers that could not be fetched, fetchedSet receives sequence numbers fetched successfully, and the returned EmailBundle contains the downloaded messages.
Returns None on failure
FetchChunkAsync (1) (2)
# startSeqNum is an integer
# count is an integer
# failedSet is a CkMessageSet
# fetchedSet is a CkMessageSet
ret_task = imap.FetchChunkAsync(startSeqNum, count, failedSet, fetchedSet);
Creates an asynchronous task to call the FetchChunk method with the arguments provided.
Returns None on failure
FetchHeaders
# messageSet is a CkMessageSet
ret_emailBundle = imap.FetchHeaders(messageSet);
Deprecated: Use FetchMsgSet instead.
Downloads only the headers for the messages identified by messageSet and returns them in an EmailBundle.
Use GetMailNumAttach, GetMailAttachSize, GetMailAttachFilename, and GetMailFlag to inspect metadata stored with a header-only email.
Returns None on failure
FetchHeadersAsync (1) (2)
Creates an asynchronous task to call the FetchHeaders method with the arguments provided.
Returns None on failure
FetchSequence
# startSeqNum is an integer
# numMessages is an integer
ret_emailBundle = imap.FetchSequence(startSeqNum, numMessages);
Deprecated: Use FetchRange instead.
Downloads numMessages messages beginning with sequence number startSeqNum and returns them in an EmailBundle.
Sequence numbers begin at 1. If the requested count extends beyond the mailbox, messages through the end of the mailbox are returned. Sequence numbers can change whenever messages are expunged.
Returns None on failure
FetchSequenceAsync (1) (2)
# startSeqNum is an integer
# numMessages is an integer
ret_task = imap.FetchSequenceAsync(startSeqNum, numMessages);
Creates an asynchronous task to call the FetchSequence method with the arguments provided.
Returns None on failure
FetchSequenceAsMime
# startSeqNum is an integer
# numMessages is an integer
ret_stringArray = imap.FetchSequenceAsMime(startSeqNum, numMessages);
Deprecated: Use FetchSingleBd or methods that return Email objects.
Downloads numMessages messages beginning at sequence number startSeqNum and returns each MIME source in a StringArray.
Sequence numbers begin at 1 and may change after an expunge. MIME can contain binary data and mixed encodings, so string-based MIME retrieval is not suitable when exact bytes must be preserved.
Returns None on failure
FetchSequenceAsMimeAsync (1) (2)
# startSeqNum is an integer
# numMessages is an integer
ret_task = imap.FetchSequenceAsMimeAsync(startSeqNum, numMessages);
Creates an asynchronous task to call the FetchSequenceAsMime method with the arguments provided.
Returns None on failure
FetchSequenceHeaders
# startSeqNum is an integer
# numMessages is an integer
ret_emailBundle = imap.FetchSequenceHeaders(startSeqNum, numMessages);
Deprecated: Use FetchRange instead.
Downloads only the headers for numMessages messages beginning with sequence number startSeqNum.
Sequence numbers begin at 1 and must be within the current range reported by NumMessages. They can change when messages are expunged.
Returns None on failure
FetchSequenceHeadersAsync (1) (2)
# startSeqNum is an integer
# numMessages is an integer
ret_task = imap.FetchSequenceHeadersAsync(startSeqNum, numMessages);
Creates an asynchronous task to call the FetchSequenceHeaders method with the arguments provided.
Returns None on failure
FetchSingle
# msgId is an integer
# bUid is a boolean
ret_email = imap.FetchSingle(msgId, bUid);
Deprecated: Use FetchEmail instead.
Downloads one message and returns it as an Email. If bUid is True, msgId is a UID; otherwise, msgId is a sequence number.
Ordinary attachment bodies are included according to AutoDownloadAttachments.
Returns None on failure
FetchSingleAsync (1) (2)
# msgId is an integer
# bUid is a boolean
ret_task = imap.FetchSingleAsync(msgId, bUid);
Creates an asynchronous task to call the FetchSingle method with the arguments provided.
Returns None on failure
FetchSingleHeader
# msgId is an integer
# bUid is a boolean
ret_email = imap.FetchSingleHeader(msgId, bUid);
Deprecated: Use FetchEmail instead.
Downloads only the headers for one message. If bUid is True, msgId is a UID; otherwise, msgId is a sequence number.
Use the attachment- and flag-inspection methods to read metadata retained in the header-only Email.
Returns None on failure
FetchSingleHeaderAsync (1) (2)
# msgId is an integer
# bUid is a boolean
ret_task = imap.FetchSingleHeaderAsync(msgId, bUid);
Creates an asynchronous task to call the FetchSingleHeader method with the arguments provided.
Returns None on failure
GetAllUids
Deprecated: Use QueryMbx instead.
Returns a MessageSet containing every UID in the currently selected mailbox.
The replacement call is equivalent to querying for ALL with UID results requested.
Returns None on failure
GetAllUidsAsync (1) (2)
Creates an asynchronous task to call the GetAllUids method with the arguments provided.
Returns None on failure
GetSslServerCert
Deprecated: Use GetServerCert instead.
Returns the certificate presented by the IMAP server for the current TLS connection.
Returns None on failure
ListMailboxes
# reference is a string
# wildcardedMailbox is a string
ret_mailboxes = imap.ListMailboxes(reference, wildcardedMailbox);
Deprecated: Use MbxList instead.
Sends the IMAP LIST command using reference as the reference name and wildcardedMailbox as the mailbox pattern.
The pattern supports IMAP wildcards: * matches zero or more hierarchy levels, while % matches within one hierarchy level. The returned Mailboxes object contains the matching names and attributes.
This method also updates SeparatorChar from the hierarchy delimiter reported by the server.
Returns None on failure
ListMailboxesAsync (1) (2)
# reference is a string
# wildcardedMailbox is a string
ret_task = imap.ListMailboxesAsync(reference, wildcardedMailbox);
Creates an asynchronous task to call the ListMailboxes method with the arguments provided.
Returns None on failure
ListSubscribed
# reference is a string
# wildcardedMailbox is a string
ret_mailboxes = imap.ListSubscribed(reference, wildcardedMailbox);
Deprecated: Use MbxList instead.
Sends the IMAP LSUB command and returns subscribed mailboxes matching wildcardedMailbox, interpreted relative to reference.
The mailbox-pattern rules are the same as for ListMailboxes.
Returns None on failure
ListSubscribedAsync (1) (2)
# reference is a string
# wildcardedMailbox is a string
ret_task = imap.ListSubscribedAsync(reference, wildcardedMailbox);
Creates an asynchronous task to call the ListSubscribed method with the arguments provided.
Returns None on failure
Search
# criteria is a string
# bUid is a boolean
ret_messageSet = imap.Search(criteria, bUid);
Deprecated: Use QueryMbx instead.
Searches the selected mailbox using the IMAP search criteria in criteria. If bUid is True, the returned MessageSet contains UIDs; otherwise, it contains sequence numbers.
criteria is passed to the server as IMAP SEARCH criteria. Multiple keys are combined with AND unless operators such as OR or NOT are used. Common examples include:
ALLUNSEENFROM "sender@example.com"SUBJECT "invoice"SINCE 1-Jul-2026UID 1000:*
String matching is performed by the server and is normally case-insensitive substring matching. SearchCharset controls the charset used for non-ASCII criteria, although some server implementations impose additional restrictions.
Returns None on failure
SearchAsync (1) (2)
# criteria is a string
# bUid is a boolean
ret_task = imap.SearchAsync(criteria, bUid);
Creates an asynchronous task to call the Search method with the arguments provided.
Returns None on failure
SendRawCommandB Deprecated
Sends the raw IMAP command text in cmd and returns the server response as bytes.
This is the byte-oriented counterpart of SendRawCommand.
Returns True for success, False for failure.
topSendRawCommandBAsync Deprecated (1)
Creates an asynchronous task to call the SendRawCommandB method with the arguments provided.
Returns None on failure
SendRawCommandC Deprecated
# outBytes is a CkByteData (output)
status = imap.SendRawCommandC(cmd, outData);
Sends the raw IMAP command bytes in cmd and returns the server response as bytes.
Use this when the command itself cannot be represented safely as an ordinary string.
Returns True for success, False for failure.
topSendRawCommandCAsync Deprecated (1)
Creates an asynchronous task to call the SendRawCommandC method with the arguments provided.
Returns None on failure
Sort
# sortCriteria is a string
# charset is a string
# searchCriteria is a string
# bUid is a boolean
ret_messageSet = imap.Sort(sortCriteria, charset, searchCriteria, bUid);
Deprecated: Use QueryMbx instead.
Searches the selected mailbox using criteria searchCriteria and returns the matching message identifiers in the order requested by sortCriteria.
sortCriteria is a space-separated sort expression. REVERSE before a key makes that key descending. Supported keys include ARRIVAL, CC, DATE, FROM, SIZE, SUBJECT, and TO.
charset is the search charset. If bUid is True, the returned set contains UIDs; otherwise, sequence numbers are returned. The server must support IMAP SORT.
Returns None on failure
SortAsync (1) (2)
# sortCriteria is a string
# charset is a string
# searchCriteria is a string
# bUid is a boolean
ret_task = imap.SortAsync(sortCriteria, charset, searchCriteria, bUid);
Creates an asynchronous task to call the Sort method with the arguments provided.
Returns None on failure
ThreadCmd
# threadAlg is a string
# charset is a string
# searchCriteria is a string
# bUid is a boolean
ret_jsonObject = imap.ThreadCmd(threadAlg, charset, searchCriteria, bUid);
Deprecated: Use QueryThread instead.
Sends the IMAP THREAD command using threading algorithm threadAlg, charset charset, and search criteria searchCriteria.
Common algorithms are ORDEREDSUBJECT and REFERENCES. If bUid is True, thread members are UIDs; otherwise, they are sequence numbers. The returned JsonObject represents the parent-child thread structure.
The server must advertise the IMAP THREAD capability and support the requested algorithm.
Returns None on failure
ThreadCmdAsync (1) (2)
# threadAlg is a string
# charset is a string
# searchCriteria is a string
# bUid is a boolean
ret_task = imap.ThreadCmdAsync(threadAlg, charset, searchCriteria, bUid);
Creates an asynchronous task to call the ThreadCmd method with the arguments provided.
Returns None on failure