Imap Unicode C Reference Documentation

Imap

Current Version: 11.5.0

Chilkat.Imap

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

Connect with SSL/TLS, STARTTLS, OAuth2, password authentication, proxy settings, timeouts, and connection diagnostics.

Mailbox selection and listing

List mailboxes, select folders, inspect mailbox state, and work with server-side folders such as Inbox, Sent, Archive, or custom folders.

Search and fetch messages

Search by IMAP criteria, work with UIDs or sequence numbers, download full messages, headers, MIME, body text, or selected message parts.

Message management

Set and clear flags, mark messages read or unread, copy or move messages, delete messages, expunge mailboxes, and append MIME to folders.

Attachments and MIME

Retrieve email as Chilkat Email objects, process MIME content, and save or inspect attachments as needed.

IDLE and diagnostics

Monitor mailbox changes with IMAP IDLE and use detailed logging, response text, and LastErrorText to troubleshoot servers.

Common pattern: Connect securely, authenticate, select a mailbox, search or fetch messages using UIDs when possible, perform message or folder operations, then disconnect cleanly. Use detailed diagnostics when working with provider- specific IMAP behavior.

Create/Dispose

HCkImapW instance = CkImapW_Create();
// ...
CkImapW_Dispose(instance);
HCkImapW CkImapW_Create(void);

Creates an instance of the HCkImapW object and returns a handle ("void *" pointer). The handle is passed in the 1st argument for the functions listed on this page.

void CkImapW_Dispose(HCkImapW handle);

Objects created by calling CkImapW_Create must be freed by calling this method. A memory leak occurs if a handle is not disposed by calling this function. Also, any handle returned by a Chilkat "C" function must also be freed by the application by calling the appropriate Dispose method, such as CkImapW_Dispose.

Callback Functions

Callback Functions introduced in Chilkat v9.5.0.56
void CkImapW_setAbortCheck(HCkImapW cHandle, BOOL (*fnAbortCheck)(void));

Provides the opportunity for a method call to be aborted. If TRUE is returned, the operation in progress is aborted. Return FALSE to allow the current method call to continue. This callback function is called periodically based on the value of the HeartbeatMs property. (If HeartbeatMs is 0, then no callbacks are made.) As an example, to make 5 AbortCheck callbacks per second, set the HeartbeatMs property equal to 200.

void CkImapW_setPercentDone(HCkImapW cHandle, BOOL (*fnPercentDone)(int pctDone));

Provides the percentage completed for any method that involves network communications or time-consuming processing (assuming it is a method where a percentage completion can be measured). This callback is only called when it is possible to know a percentage completion, and when it makes sense to express the operation as a percentage completed. The pctDone argument will have a value from 1 to 100. For methods that complete very quickly, the number of PercentDone callbacks will vary, but the final callback should have a value of 100. For long running operations, no more than one callback per percentage point will occur (for example: 1, 2, 3, ... 98, 99, 100).

This callback counts as an AbortCheck callback, and takes the place of the AbortCheck event when it fires.

The return value indicates whether the method call should be aborted, or whether it should proceed. Return TRUE to abort, and FALSE to proceed.

void CkImapW_setProgressInfo(HCkImapW cHandle, void (*fnProgressInfo)(const wchar_t *name, const wchar_t *value));

This is a general callback that provides name/value information about what is happening at certain points during a method call. To see the information provided in ProgressInfo callbacks, if any, write code to handle this event and log the name/value pairs. Most are self-explanatory.

void CkImapW_setTaskCompleted(HCkImapW cHandle, void (*fnTaskCompleted)(HCkTaskW hTask));

Called in the background thread when an asynchronous task completes. (Note: When an async method is running, all callbacks are in the background thread.)

Properties

AbortCurrent
BOOL CkImapW_getAbortCurrent(HCkImapW cHandle);
void CkImapW_putAbortCurrent(HCkImapW cHandle, BOOL newVal);
Introduced in version 9.5.0.58

Controls cancellation of the method currently running on this Imap object.

  • Set this property to TRUE to 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.

top
AppendSeen
BOOL CkImapW_getAppendSeen(HCkImapW cHandle);
void CkImapW_putAppendSeen(HCkImapW cHandle, BOOL newVal);

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.

top
AppendUid
int CkImapW_getAppendUid(HCkImapW cHandle);

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.

top
AuthMethod
void CkImapW_getAuthMethod(HCkImapW cHandle, HCkString retval);
void CkImapW_putAuthMethod(HCkImapW cHandle, const wchar_t *newVal);
const wchar_t *CkImapW_authMethod(HCkImapW cHandle);

Selects the IMAP authentication mechanism. The default is LOGIN, and an empty string also selects the default login behavior.

ValuePurpose
LOGINUsername and password authentication.
PLAINSASL PLAIN authentication. AuthzId may also be used.
CRAM-MD5Challenge-response authentication when supported by the server.
NTLMWindows Integrated Authentication.
XOAUTH2OAuth 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.

top
AuthzId
void CkImapW_getAuthzId(HCkImapW cHandle, HCkString retval);
void CkImapW_putAuthzId(HCkImapW cHandle, const wchar_t *newVal);
const wchar_t *CkImapW_authzId(HCkImapW cHandle);

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.

top
AutoDownloadAttachments
BOOL CkImapW_getAutoDownloadAttachments(HCkImapW cHandle);
void CkImapW_putAutoDownloadAttachments(HCkImapW cHandle, BOOL newVal);

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.

top
AutoFix
BOOL CkImapW_getAutoFix(HCkImapW cHandle);
void CkImapW_putAutoFix(HCkImapW cHandle, BOOL newVal);

When TRUE (the default), adjusts the effective TLS settings when Connect is called for the standard IMAP ports:

  • Port 993: uses implicit TLS by setting Ssl to TRUE and StartTls to FALSE.
  • Port 143: sets Ssl to FALSE so the connection begins as ordinary IMAP. Explicit TLS may still be requested with StartTls.

Set this property to FALSE when the server uses nonstandard port and TLS combinations that must be controlled explicitly.

top
ClientIpAddress
void CkImapW_getClientIpAddress(HCkImapW cHandle, HCkString retval);
void CkImapW_putClientIpAddress(HCkImapW cHandle, const wchar_t *newVal);
const wchar_t *CkImapW_clientIpAddress(HCkImapW cHandle);

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.

More Information and Examples
top
ConnectedToHost
void CkImapW_getConnectedToHost(HCkImapW cHandle, HCkString retval);
const wchar_t *CkImapW_connectedToHost(HCkImapW cHandle);

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.

top
ConnectTimeout
int CkImapW_getConnectTimeout(HCkImapW cHandle);
void CkImapW_putConnectTimeout(HCkImapW cHandle, int newVal);

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.

top
DebugLogFilePath
void CkImapW_getDebugLogFilePath(HCkImapW cHandle, HCkString retval);
void CkImapW_putDebugLogFilePath(HCkImapW cHandle, const wchar_t *newVal);
const wchar_t *CkImapW_debugLogFilePath(HCkImapW cHandle);

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.

More Information and Examples
top
Domain
void CkImapW_getDomain(HCkImapW cHandle, HCkString retval);
void CkImapW_putDomain(HCkImapW cHandle, const wchar_t *newVal);
const wchar_t *CkImapW_domain(HCkImapW cHandle);

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.

top
EnableSecrets
BOOL CkImapW_getEnableSecrets(HCkImapW cHandle);
void CkImapW_putEnableSecrets(HCkImapW cHandle, BOOL newVal);
Introduced in version 11.5.0

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.

More Information and Examples
top
HeartbeatMs
int CkImapW_getHeartbeatMs(HCkImapW cHandle);
void CkImapW_putHeartbeatMs(HCkImapW cHandle, int newVal);

Sets the interval, in milliseconds, between AbortCheck event callbacks during operations that support cancellation.

The default is 0, which disables periodic AbortCheck callbacks.

More Information and Examples
top
HighestModSeq
void CkImapW_getHighestModSeq(HCkImapW cHandle, HCkString retval);
const wchar_t *CkImapW_highestModSeq(HCkImapW cHandle);
Introduced in version 9.5.0.87

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.

top
HttpProxyAuthMethod
void CkImapW_getHttpProxyAuthMethod(HCkImapW cHandle, HCkString retval);
void CkImapW_putHttpProxyAuthMethod(HCkImapW cHandle, const wchar_t *newVal);
const wchar_t *CkImapW_httpProxyAuthMethod(HCkImapW cHandle);

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.

top
HttpProxyDomain
void CkImapW_getHttpProxyDomain(HCkImapW cHandle, HCkString retval);
void CkImapW_putHttpProxyDomain(HCkImapW cHandle, const wchar_t *newVal);
const wchar_t *CkImapW_httpProxyDomain(HCkImapW cHandle);

Specifies the optional Windows domain for HTTP-proxy NTLM authentication.

It is ignored when the proxy does not use NTLM authentication.

top
HttpProxyHostname
void CkImapW_getHttpProxyHostname(HCkImapW cHandle, HCkString retval);
void CkImapW_putHttpProxyHostname(HCkImapW cHandle, const wchar_t *newVal);
const wchar_t *CkImapW_httpProxyHostname(HCkImapW cHandle);

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.

top
HttpProxyPassword
void CkImapW_getHttpProxyPassword(HCkImapW cHandle, HCkString retval);
void CkImapW_putHttpProxyPassword(HCkImapW cHandle, const wchar_t *newVal);
const wchar_t *CkImapW_httpProxyPassword(HCkImapW cHandle);

Specifies the password used to authenticate with the configured HTTP proxy.

It is used only when the proxy requires authentication.

top
HttpProxyPort
int CkImapW_getHttpProxyPort(HCkImapW cHandle);
void CkImapW_putHttpProxyPort(HCkImapW cHandle, int newVal);

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.

top
HttpProxyUsername
void CkImapW_getHttpProxyUsername(HCkImapW cHandle, HCkString retval);
void CkImapW_putHttpProxyUsername(HCkImapW cHandle, const wchar_t *newVal);
const wchar_t *CkImapW_httpProxyUsername(HCkImapW cHandle);

Specifies the username used to authenticate with the configured HTTP proxy.

It is used only when the proxy requires authentication.

top
KeepSessionLog
BOOL CkImapW_getKeepSessionLog(HCkImapW cHandle);
void CkImapW_putKeepSessionLog(HCkImapW cHandle, BOOL newVal);

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.

More Information and Examples
top
LastAppendedMime
void CkImapW_getLastAppendedMime(HCkImapW cHandle, HCkString retval);
const wchar_t *CkImapW_lastAppendedMime(HCkImapW cHandle);

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.

top
LastCommand
void CkImapW_getLastCommand(HCkImapW cHandle, HCkString retval);
const wchar_t *CkImapW_lastCommand(HCkImapW cHandle);

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.

top
LastErrorHtml
void CkImapW_getLastErrorHtml(HCkImapW cHandle, HCkString retval);
const wchar_t *CkImapW_lastErrorHtml(HCkImapW cHandle);

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.

top
LastErrorText
void CkImapW_getLastErrorText(HCkImapW cHandle, HCkString retval);
const wchar_t *CkImapW_lastErrorText(HCkImapW cHandle);

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.

top
LastErrorXml
void CkImapW_getLastErrorXml(HCkImapW cHandle, HCkString retval);
const wchar_t *CkImapW_lastErrorXml(HCkImapW cHandle);

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.

top
LastIntermediateResponse
void CkImapW_getLastIntermediateResponse(HCkImapW cHandle, HCkString retval);
const wchar_t *CkImapW_lastIntermediateResponse(HCkImapW cHandle);

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.

top
LastMethodSuccess
BOOL CkImapW_getLastMethodSuccess(HCkImapW cHandle);
void CkImapW_putLastMethodSuccess(HCkImapW cHandle, BOOL newVal);

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.

top
LastResponse
void CkImapW_getLastResponse(HCkImapW cHandle, HCkString retval);
const wchar_t *CkImapW_lastResponse(HCkImapW cHandle);

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.

More Information and Examples
top
LastResponseCode
void CkImapW_getLastResponseCode(HCkImapW cHandle, HCkString retval);
const wchar_t *CkImapW_lastResponseCode(HCkImapW cHandle);
Introduced in version 9.5.0.44

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.

More Information and Examples
top
LoggedInUser
void CkImapW_getLoggedInUser(HCkImapW cHandle, HCkString retval);
const wchar_t *CkImapW_loggedInUser(HCkImapW cHandle);

Contains the username of the authenticated IMAP session.

Returns an empty string when the object is not logged in.

top
NumMessages
int CkImapW_getNumMessages(HCkImapW cHandle);

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.

top
PeekMode
BOOL CkImapW_getPeekMode(HCkImapW cHandle);
void CkImapW_putPeekMode(HCkImapW cHandle, BOOL newVal);

Controls whether fetching message content marks the message as seen.

  • FALSE (the default): a fetch may set the \Seen flag.
  • TRUE: message data is fetched without setting \Seen, using IMAP peek semantics.

top
PercentDoneScale
int CkImapW_getPercentDoneScale(HCkImapW cHandle);
void CkImapW_putPercentDoneScale(HCkImapW cHandle, int newVal);
Introduced in version 9.5.0.49

Sets the scale used by PercentDone event callbacks. The default is 100.

For example, a scale of 1000 gives tenths-of-a-percent precision, so a callback value of 453 represents 45.3% complete. Values are limited to the range 10 through 100000.

This property applies only to languages and environments that support event callbacks and only to operations for which progress can be measured.

top
Port
int CkImapW_getPort(HCkImapW cHandle);
void CkImapW_putPort(HCkImapW cHandle, int newVal);

Specifies the IMAP server port.

  • 993 is the standard port for implicit TLS and is normally used with Ssl set to TRUE.
  • 143 is the standard port for ordinary IMAP and for explicit TLS requested with StartTls.

When AutoFix is enabled, standard port values are used to adjust the effective TLS configuration when connecting.

top
PreferIpv6
BOOL CkImapW_getPreferIpv6(HCkImapW cHandle);
void CkImapW_putPreferIpv6(HCkImapW cHandle, BOOL newVal);

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.

top
ReadTimeout
int CkImapW_getReadTimeout(HCkImapW cHandle);
void CkImapW_putReadTimeout(HCkImapW cHandle, int newVal);

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.

top
RequireSslCertVerify
BOOL CkImapW_getRequireSslCertVerify(HCkImapW cHandle);
void CkImapW_putRequireSslCertVerify(HCkImapW cHandle, BOOL newVal);

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.

top
SearchCharset
void CkImapW_getSearchCharset(HCkImapW cHandle, HCkString retval);
void CkImapW_putSearchCharset(HCkImapW cHandle, const wchar_t *newVal);
const wchar_t *CkImapW_searchCharset(HCkImapW cHandle);

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.

top
SelectedMailbox
void CkImapW_getSelectedMailbox(HCkImapW cHandle, HCkString retval);
const wchar_t *CkImapW_selectedMailbox(HCkImapW cHandle);

Contains the name of the currently selected or examined mailbox.

Returns an empty string when no mailbox is selected.

top
SendBufferSize
int CkImapW_getSendBufferSize(HCkImapW cHandle);
void CkImapW_putSendBufferSize(HCkImapW cHandle, int newVal);

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.

top
SeparatorChar
void CkImapW_getSeparatorChar(HCkImapW cHandle, HCkString retval);
void CkImapW_putSeparatorChar(HCkImapW cHandle, const wchar_t *newVal);
const wchar_t *CkImapW_separatorChar(HCkImapW cHandle);

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.

top
SessionLog
void CkImapW_getSessionLog(HCkImapW cHandle, HCkString retval);
const wchar_t *CkImapW_sessionLog(HCkImapW cHandle);

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.

More Information and Examples
top
SocksHostname
void CkImapW_getSocksHostname(HCkImapW cHandle, HCkString retval);
void CkImapW_putSocksHostname(HCkImapW cHandle, const wchar_t *newVal);
const wchar_t *CkImapW_socksHostname(HCkImapW cHandle);

Specifies the hostname or numeric IP address of the SOCKS proxy.

This property is used only when SocksVersion is 4 or 5.

top
SocksPassword
void CkImapW_getSocksPassword(HCkImapW cHandle, HCkString retval);
void CkImapW_putSocksPassword(HCkImapW cHandle, const wchar_t *newVal);
const wchar_t *CkImapW_socksPassword(HCkImapW cHandle);

Specifies the SOCKS5 proxy password.

It is ignored for SOCKS4 because SOCKS4 does not define password authentication.

top
SocksPort
int CkImapW_getSocksPort(HCkImapW cHandle);
void CkImapW_putSocksPort(HCkImapW cHandle, int newVal);

Specifies the SOCKS proxy port. The default is 1080.

This property is used only when SocksVersion is 4 or 5.

top
SocksUsername
void CkImapW_getSocksUsername(HCkImapW cHandle, HCkString retval);
void CkImapW_putSocksUsername(HCkImapW cHandle, const wchar_t *newVal);
const wchar_t *CkImapW_socksUsername(HCkImapW cHandle);

Specifies the username sent to a SOCKS4 or SOCKS5 proxy.

This property is used only when SocksVersion is 4 or 5.

top
SocksVersion
int CkImapW_getSocksVersion(HCkImapW cHandle);
void CkImapW_putSocksVersion(HCkImapW cHandle, int newVal);

Selects whether the IMAP connection uses a SOCKS proxy.

ValueBehavior
0Do not use a SOCKS proxy. This is the default.
4Connect through a SOCKS4 proxy.
5Connect through a SOCKS5 proxy.

top
SoRcvBuf
int CkImapW_getSoRcvBuf(HCkImapW cHandle);
void CkImapW_putSoRcvBuf(HCkImapW cHandle, int newVal);

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.

top
SortCriteria
void CkImapW_getSortCriteria(HCkImapW cHandle, HCkString retval);
void CkImapW_putSortCriteria(HCkImapW cHandle, const wchar_t *newVal);
const wchar_t *CkImapW_sortCriteria(HCkImapW cHandle);
Introduced in version 11.0.0

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.

  • ARRIVAL
  • CC
  • DATE
  • FROM
  • SIZE
  • SUBJECT
  • TO

Examples include SUBJECT REVERSE DATE, REVERSE SIZE, and ARRIVAL. The server must advertise the IMAP SORT capability.

top
SoSndBuf
int CkImapW_getSoSndBuf(HCkImapW cHandle);
void CkImapW_putSoSndBuf(HCkImapW cHandle, int newVal);

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.

top
Ssl
BOOL CkImapW_getSsl(HCkImapW cHandle);
void CkImapW_putSsl(HCkImapW cHandle, BOOL newVal);

Controls implicit TLS for the IMAP connection.

  • TRUE: begin the connection with a TLS handshake, typically on port 993.
  • FALSE: begin with ordinary IMAP. Use StartTls when the server requires an explicit STARTTLS upgrade.

top
SslAllowedCiphers
void CkImapW_getSslAllowedCiphers(HCkImapW cHandle, HCkString retval);
void CkImapW_putSslAllowedCiphers(HCkImapW cHandle, const wchar_t *newVal);
const wchar_t *CkImapW_sslAllowedCiphers(HCkImapW cHandle);
Introduced in version 9.5.0.48

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:

  • rsa1024 or rsa2048 to require a minimum RSA server-key size.
  • secure-renegotiation to require secure TLS renegotiation.
  • best-practices to 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.

top
SslProtocol
void CkImapW_getSslProtocol(HCkImapW cHandle, HCkString retval);
void CkImapW_putSslProtocol(HCkImapW cHandle, const wchar_t *newVal);
const wchar_t *CkImapW_sslProtocol(HCkImapW cHandle);

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.

top
SslServerCertVerified
BOOL CkImapW_getSslServerCertVerified(HCkImapW cHandle);

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.

top
StartTls
BOOL CkImapW_getStartTls(HCkImapW cHandle);
void CkImapW_putStartTls(HCkImapW cHandle, BOOL newVal);

Controls explicit TLS using the IMAP STARTTLS command.

  • TRUE: connect in clear text, issue STARTTLS, 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.

top
TlsCipherSuite
void CkImapW_getTlsCipherSuite(HCkImapW cHandle, HCkString retval);
const wchar_t *CkImapW_tlsCipherSuite(HCkImapW cHandle);
Introduced in version 9.5.0.49

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.

top
TlsPinSet
void CkImapW_getTlsPinSet(HCkImapW cHandle, HCkString retval);
void CkImapW_putTlsPinSet(HCkImapW cHandle, const wchar_t *newVal);
const wchar_t *CkImapW_tlsPinSet(HCkImapW cHandle);
Introduced in version 9.5.0.55

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.

More Information and Examples
top
TlsVersion
void CkImapW_getTlsVersion(HCkImapW cHandle, HCkString retval);
const wchar_t *CkImapW_tlsVersion(HCkImapW cHandle);
Introduced in version 9.5.0.49

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.

top
UidNext
unsigned long CkImapW_getUidNext(HCkImapW cHandle);

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.

top
UidValidity
unsigned long CkImapW_getUidValidity(HCkImapW cHandle);

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.

top
UncommonOptions
void CkImapW_getUncommonOptions(HCkImapW cHandle, HCkString retval);
void CkImapW_putUncommonOptions(HCkImapW cHandle, const wchar_t *newVal);
const wchar_t *CkImapW_uncommonOptions(HCkImapW cHandle);
Introduced in version 9.5.0.80

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.

More Information and Examples
top
VerboseLogging
BOOL CkImapW_getVerboseLogging(HCkImapW cHandle);
void CkImapW_putVerboseLogging(HCkImapW cHandle, BOOL newVal);

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.

top
Version
void CkImapW_getVersion(HCkImapW cHandle, HCkString retval);
const wchar_t *CkImapW_version(HCkImapW cHandle);

Version of the component/library, such as "10.1.0"

More Information and Examples
top

Methods

AddPfxSourceBd
BOOL CkImapW_AddPfxSourceBd(HCkImapW cHandle, HCkBinDataW bd, const wchar_t *password);
Introduced in version 11.0.0

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.

top
AddPfxSourceFile
BOOL CkImapW_AddPfxSourceFile(HCkImapW cHandle, const wchar_t *pfxFilePath, const wchar_t *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.

top
AppendMail
BOOL CkImapW_AppendMail(HCkImapW cHandle, const wchar_t *mailbox, HCkEmailW email);

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.

top
AppendMailAsync (1)
HCkTaskW CkImapW_AppendMailAsync(HCkImapW cHandle, const wchar_t *mailbox, HCkEmailW email);

Creates an asynchronous task to call the AppendMail method with the arguments provided.

Returns NULL on failure

More Information and Examples
top
AppendMime
BOOL CkImapW_AppendMime(HCkImapW cHandle, const wchar_t *mailbox, const wchar_t *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.

More Information and Examples
top
AppendMimeAsync (1)
HCkTaskW CkImapW_AppendMimeAsync(HCkImapW cHandle, const wchar_t *mailbox, const wchar_t *mimeText);

Creates an asynchronous task to call the AppendMime method with the arguments provided.

Returns NULL on failure

top
AppendMimeWithDateStr
BOOL CkImapW_AppendMimeWithDateStr(HCkImapW cHandle, const wchar_t *mailbox, const wchar_t *mimeText, const wchar_t *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.

top
AppendMimeWithDateStrAsync (1)
HCkTaskW CkImapW_AppendMimeWithDateStrAsync(HCkImapW cHandle, const wchar_t *mailbox, const wchar_t *mimeText, const wchar_t *internalDateStr);

Creates an asynchronous task to call the AppendMimeWithDateStr method with the arguments provided.

Returns NULL on failure

top
AppendMimeWithFlags
BOOL CkImapW_AppendMimeWithFlags(HCkImapW cHandle, const wchar_t *mailbox, const wchar_t *mimeText, BOOL seen, BOOL flagged, BOOL answered, BOOL draft);

Appends the MIME message in mimeText to the mailbox named by mailbox and sets its initial system flags.

  • seen controls \Seen.
  • flagged controls \Flagged.
  • answered controls \Answered.
  • draft controls \Draft.

Use TRUE to set a flag and FALSE to leave it unset.

Returns TRUE for success, FALSE for failure.

top
AppendMimeWithFlagsAsync (1)
HCkTaskW CkImapW_AppendMimeWithFlagsAsync(HCkImapW cHandle, const wchar_t *mailbox, const wchar_t *mimeText, BOOL seen, BOOL flagged, BOOL answered, BOOL draft);

Creates an asynchronous task to call the AppendMimeWithFlags method with the arguments provided.

Returns NULL on failure

top
AppendMimeWithFlagsSb
BOOL CkImapW_AppendMimeWithFlagsSb(HCkImapW cHandle, const wchar_t *mailbox, HCkStringBuilderW sbMime, BOOL seen, BOOL flagged, BOOL answered, BOOL draft);
Introduced in version 9.5.0.62

Appends the MIME contained in the StringBuilder in sbMime to mailbox mailbox and sets its initial flags.

  • seen controls \Seen.
  • flagged controls \Flagged.
  • answered controls \Answered.
  • draft controls \Draft.

Returns TRUE for success, FALSE for failure.

top
AppendMimeWithFlagsSbAsync (1)
HCkTaskW CkImapW_AppendMimeWithFlagsSbAsync(HCkImapW cHandle, const wchar_t *mailbox, HCkStringBuilderW sbMime, BOOL seen, BOOL flagged, BOOL answered, BOOL draft);
Introduced in version 9.5.0.62

Creates an asynchronous task to call the AppendMimeWithFlagsSb method with the arguments provided.

Returns NULL on failure

top
Capability
BOOL CkImapW_Capability(HCkImapW cHandle, const wchar_t *outStr);
const wchar_t *CkImapW_capability(HCkImapW cHandle);

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.

More Information and Examples
top
CapabilityAsync (1)
HCkTaskW CkImapW_CapabilityAsync(HCkImapW cHandle);

Creates an asynchronous task to call the Capability method with the arguments provided.

Returns NULL on failure

top
CheckConnection
BOOL CkImapW_CheckConnection(HCkImapW cHandle);
Introduced in version 9.5.0.46

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.

top
ClearSessionLog
void CkImapW_ClearSessionLog(HCkImapW cHandle);

Clears the in-memory text returned by SessionLog.

Session logging remains enabled or disabled according to KeepSessionLog.

top
CloseMailbox
BOOL CkImapW_CloseMailbox(HCkImapW cHandle, const wchar_t *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.

top
CloseMailboxAsync (1)
HCkTaskW CkImapW_CloseMailboxAsync(HCkImapW cHandle, const wchar_t *mailbox);

Creates an asynchronous task to call the CloseMailbox method with the arguments provided.

Returns NULL on failure

top
Connect
BOOL CkImapW_Connect(HCkImapW cHandle, const wchar_t *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.

More Information and Examples
top
ConnectAsync (1)
HCkTaskW CkImapW_ConnectAsync(HCkImapW cHandle, const wchar_t *domainName);

Creates an asynchronous task to call the Connect method with the arguments provided.

Returns NULL on failure

top
Copy
BOOL CkImapW_Copy(HCkImapW cHandle, unsigned long msgId, BOOL bUid, const wchar_t *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.

top
CopyAsync (1)
HCkTaskW CkImapW_CopyAsync(HCkImapW cHandle, unsigned long msgId, BOOL bUid, const wchar_t *copyToMailbox);

Creates an asynchronous task to call the Copy method with the arguments provided.

Returns NULL on failure

top
CopyMultiple
BOOL CkImapW_CopyMultiple(HCkImapW cHandle, HCkMessageSetW messageSet, const wchar_t *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.

top
CopyMultipleAsync (1)
HCkTaskW CkImapW_CopyMultipleAsync(HCkImapW cHandle, HCkMessageSetW messageSet, const wchar_t *copyToMailbox);

Creates an asynchronous task to call the CopyMultiple method with the arguments provided.

Returns NULL on failure

top
CopySequence
BOOL CkImapW_CopySequence(HCkImapW cHandle, int startSeqNum, int count, const wchar_t *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.

top
CopySequenceAsync (1)
HCkTaskW CkImapW_CopySequenceAsync(HCkImapW cHandle, int startSeqNum, int count, const wchar_t *copyToMailbox);

Creates an asynchronous task to call the CopySequence method with the arguments provided.

Returns NULL on failure

top
CreateMailbox
BOOL CkImapW_CreateMailbox(HCkImapW cHandle, const wchar_t *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.

top
CreateMailboxAsync (1)
HCkTaskW CkImapW_CreateMailboxAsync(HCkImapW cHandle, const wchar_t *mailbox);

Creates an asynchronous task to call the CreateMailbox method with the arguments provided.

Returns NULL on failure

top
DeleteMailbox
BOOL CkImapW_DeleteMailbox(HCkImapW cHandle, const wchar_t *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.

top
DeleteMailboxAsync (1)
HCkTaskW CkImapW_DeleteMailboxAsync(HCkImapW cHandle, const wchar_t *mailbox);

Creates an asynchronous task to call the DeleteMailbox method with the arguments provided.

Returns NULL on failure

top
Disconnect
BOOL CkImapW_Disconnect(HCkImapW cHandle);

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.

top
DisconnectAsync (1)
HCkTaskW CkImapW_DisconnectAsync(HCkImapW cHandle);

Creates an asynchronous task to call the Disconnect method with the arguments provided.

Returns NULL on failure

top
ExamineMailbox
BOOL CkImapW_ExamineMailbox(HCkImapW cHandle, const wchar_t *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.

top
ExamineMailboxAsync (1)
HCkTaskW CkImapW_ExamineMailboxAsync(HCkImapW cHandle, const wchar_t *mailbox);

Creates an asynchronous task to call the ExamineMailbox method with the arguments provided.

Returns NULL on failure

top
Expunge
BOOL CkImapW_Expunge(HCkImapW cHandle);

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.

top
ExpungeAsync (1)
HCkTaskW CkImapW_ExpungeAsync(HCkImapW cHandle);

Creates an asynchronous task to call the Expunge method with the arguments provided.

Returns NULL on failure

top
ExpungeAndClose
BOOL CkImapW_ExpungeAndClose(HCkImapW cHandle);

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.

top
ExpungeAndCloseAsync (1)
HCkTaskW CkImapW_ExpungeAndCloseAsync(HCkImapW cHandle);

Creates an asynchronous task to call the ExpungeAndClose method with the arguments provided.

Returns NULL on failure

top
FetchAttachment
BOOL CkImapW_FetchAttachment(HCkImapW cHandle, HCkEmailW emailObject, int attachmentIndex, const wchar_t *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.

top
FetchAttachmentAsync (1)
HCkTaskW CkImapW_FetchAttachmentAsync(HCkImapW cHandle, HCkEmailW emailObject, int attachmentIndex, const wchar_t *saveToPath);

Creates an asynchronous task to call the FetchAttachment method with the arguments provided.

Returns NULL on failure

top
FetchAttachmentBd
BOOL CkImapW_FetchAttachmentBd(HCkImapW cHandle, HCkEmailW email, int attachmentIndex, HCkBinDataW binData);
Introduced in version 9.5.0.62

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.

top
FetchAttachmentBdAsync (1)
HCkTaskW CkImapW_FetchAttachmentBdAsync(HCkImapW cHandle, HCkEmailW email, int attachmentIndex, HCkBinDataW binData);
Introduced in version 9.5.0.62

Creates an asynchronous task to call the FetchAttachmentBd method with the arguments provided.

Returns NULL on failure

top
FetchAttachmentSb
BOOL CkImapW_FetchAttachmentSb(HCkImapW cHandle, HCkEmailW email, int attachmentIndex, const wchar_t *charset, HCkStringBuilderW sb);
Introduced in version 9.5.0.62

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.

top
FetchAttachmentSbAsync (1)
HCkTaskW CkImapW_FetchAttachmentSbAsync(HCkImapW cHandle, HCkEmailW email, int attachmentIndex, const wchar_t *charset, HCkStringBuilderW sb);
Introduced in version 9.5.0.62

Creates an asynchronous task to call the FetchAttachmentSb method with the arguments provided.

Returns NULL on failure

top
FetchAttachmentString
BOOL CkImapW_FetchAttachmentString(HCkImapW cHandle, HCkEmailW emailObject, int attachmentIndex, const wchar_t *charset, const wchar_t *outStr);
const wchar_t *CkImapW_fetchAttachmentString(HCkImapW cHandle, HCkEmailW emailObject, int attachmentIndex, const wchar_t *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.

top
FetchAttachmentStringAsync (1)
HCkTaskW CkImapW_FetchAttachmentStringAsync(HCkImapW cHandle, HCkEmailW emailObject, int attachmentIndex, const wchar_t *charset);

Creates an asynchronous task to call the FetchAttachmentString method with the arguments provided.

Returns NULL on failure

top
FetchChunk2
BOOL CkImapW_FetchChunk2(HCkImapW cHandle, int seqnum, int count, HCkMessageSetW failedSet, HCkMessageSetW fetchedSet, HCkEmailBundleW bundle);
Introduced in version 11.0.0

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.

top
FetchChunk2Async (1)
HCkTaskW CkImapW_FetchChunk2Async(HCkImapW cHandle, int seqnum, int count, HCkMessageSetW failedSet, HCkMessageSetW fetchedSet, HCkEmailBundleW bundle);
Introduced in version 11.0.0

Creates an asynchronous task to call the FetchChunk2 method with the arguments provided.

Returns NULL on failure

top
FetchEmail
BOOL CkImapW_FetchEmail(HCkImapW cHandle, BOOL headerOnly, unsigned long msgId, BOOL bUid, HCkEmailW email);
Introduced in version 11.0.0

Downloads one message or its headers into the Email in email.

  • headerOnly = TRUE: download headers only.
  • headerOnly = FALSE: download the full message.
  • bUid = TRUE: msgId is a UID.
  • bUid = FALSE: msgId is a sequence number.

For a full download, ordinary attachment bodies are included according to AutoDownloadAttachments.

Returns TRUE for success, FALSE for failure.

top
FetchEmailAsync (1)
HCkTaskW CkImapW_FetchEmailAsync(HCkImapW cHandle, BOOL headerOnly, unsigned long msgId, BOOL bUid, HCkEmailW email);
Introduced in version 11.0.0

Creates an asynchronous task to call the FetchEmail method with the arguments provided.

Returns NULL on failure

top
FetchFlags
BOOL CkImapW_FetchFlags(HCkImapW cHandle, unsigned long msgId, BOOL bUid, const wchar_t *outStrFlags);
const wchar_t *CkImapW_fetchFlags(HCkImapW cHandle, unsigned long msgId, BOOL 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.

top
FetchFlagsAsync (1)
HCkTaskW CkImapW_FetchFlagsAsync(HCkImapW cHandle, unsigned long msgId, BOOL bUid);

Creates an asynchronous task to call the FetchFlags method with the arguments provided.

Returns NULL on failure

top
FetchMsgSet
BOOL CkImapW_FetchMsgSet(HCkImapW cHandle, BOOL headersOnly, HCkMessageSetW msgSet, HCkEmailBundleW bundle);
Introduced in version 11.0.0

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 by AutoDownloadAttachments.

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.

top
FetchMsgSetAsync (1)
HCkTaskW CkImapW_FetchMsgSetAsync(HCkImapW cHandle, BOOL headersOnly, HCkMessageSetW msgSet, HCkEmailBundleW bundle);
Introduced in version 11.0.0

Creates an asynchronous task to call the FetchMsgSet method with the arguments provided.

Returns NULL on failure

top
FetchRange
BOOL CkImapW_FetchRange(HCkImapW cHandle, BOOL headersOnly, int seqnum, int count, HCkEmailBundleW bundle);
Introduced in version 11.0.0

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.

top
FetchRangeAsync (1)
HCkTaskW CkImapW_FetchRangeAsync(HCkImapW cHandle, BOOL headersOnly, int seqnum, int count, HCkEmailBundleW bundle);
Introduced in version 11.0.0

Creates an asynchronous task to call the FetchRange method with the arguments provided.

Returns NULL on failure

top
FetchSingleAsMime
BOOL CkImapW_FetchSingleAsMime(HCkImapW cHandle, unsigned long msgId, BOOL bUid, const wchar_t *outStrMime);
const wchar_t *CkImapW_fetchSingleAsMime(HCkImapW cHandle, unsigned long msgId, BOOL 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.

More Information and Examples
top
FetchSingleAsMimeAsync (1)
HCkTaskW CkImapW_FetchSingleAsMimeAsync(HCkImapW cHandle, unsigned long msgId, BOOL bUid);

Creates an asynchronous task to call the FetchSingleAsMime method with the arguments provided.

Returns NULL on failure

top
FetchSingleAsMimeSb
BOOL CkImapW_FetchSingleAsMimeSb(HCkImapW cHandle, unsigned long msgId, BOOL bUid, HCkStringBuilderW sbMime);
Introduced in version 9.5.0.62

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.

top
FetchSingleAsMimeSbAsync (1)
HCkTaskW CkImapW_FetchSingleAsMimeSbAsync(HCkImapW cHandle, unsigned long msgId, BOOL bUid, HCkStringBuilderW sbMime);
Introduced in version 9.5.0.62

Creates an asynchronous task to call the FetchSingleAsMimeSb method with the arguments provided.

Returns NULL on failure

top
FetchSingleBd
BOOL CkImapW_FetchSingleBd(HCkImapW cHandle, unsigned long msgId, BOOL bUid, HCkBinDataW mimeData);
Introduced in version 9.5.0.76

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.

top
FetchSingleBdAsync (1)
HCkTaskW CkImapW_FetchSingleBdAsync(HCkImapW cHandle, unsigned long msgId, BOOL bUid, HCkBinDataW mimeData);
Introduced in version 9.5.0.76

Creates an asynchronous task to call the FetchSingleBd method with the arguments provided.

Returns NULL on failure

top
FetchSingleHeaderAsMime
BOOL CkImapW_FetchSingleHeaderAsMime(HCkImapW cHandle, unsigned long msgId, BOOL bUID, const wchar_t *outStr);
const wchar_t *CkImapW_fetchSingleHeaderAsMime(HCkImapW cHandle, unsigned long msgId, BOOL 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.

top
FetchSingleHeaderAsMimeAsync (1)
HCkTaskW CkImapW_FetchSingleHeaderAsMimeAsync(HCkImapW cHandle, unsigned long msgId, BOOL bUID);

Creates an asynchronous task to call the FetchSingleHeaderAsMime method with the arguments provided.

Returns NULL on failure

top
GetMailAttachFilename
BOOL CkImapW_GetMailAttachFilename(HCkImapW cHandle, HCkEmailW email, int attachIndex, const wchar_t *outStrFilename);
const wchar_t *CkImapW_getMailAttachFilename(HCkImapW cHandle, HCkEmailW email, int 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.

top
GetMailAttachSize
int CkImapW_GetMailAttachSize(HCkImapW cHandle, HCkEmailW email, int 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.

top
GetMailboxStatus
BOOL CkImapW_GetMailboxStatus(HCkImapW cHandle, const wchar_t *mailbox, const wchar_t *outStr);
const wchar_t *CkImapW_getMailboxStatus(HCkImapW cHandle, const wchar_t *mailbox);
Introduced in version 9.5.0.46

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 \Recent flag.
  • uidnext: expected UID for the next appended message.
  • uidvalidity: mailbox UID-validity value.
  • unseen: messages without the \Seen flag.
<status messages="240" recent="0" uidnext="3674" uidvalidity="3" unseen="213" />

Returns TRUE for success, FALSE for failure.

top
GetMailboxStatusAsync (1)
HCkTaskW CkImapW_GetMailboxStatusAsync(HCkImapW cHandle, const wchar_t *mailbox);
Introduced in version 9.5.0.46

Creates an asynchronous task to call the GetMailboxStatus method with the arguments provided.

Returns NULL on failure

top
GetMailFlag
int CkImapW_GetMailFlag(HCkImapW cHandle, HCkEmailW email, const wchar_t *flagName);

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.

More Information and Examples
top
GetMailNumAttach
int CkImapW_GetMailNumAttach(HCkImapW cHandle, HCkEmailW email);

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.

top
GetMailSize
int CkImapW_GetMailSize(HCkImapW cHandle, HCkEmailW email);

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.

More Information and Examples
top
GetQuota
BOOL CkImapW_GetQuota(HCkImapW cHandle, const wchar_t *quotaRoot, const wchar_t *outStr);
const wchar_t *CkImapW_getQuota(HCkImapW cHandle, const wchar_t *quotaRoot);
Introduced in version 9.5.0.58

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.

More Information and Examples
top
GetQuotaAsync (1)
HCkTaskW CkImapW_GetQuotaAsync(HCkImapW cHandle, const wchar_t *quotaRoot);
Introduced in version 9.5.0.58

Creates an asynchronous task to call the GetQuota method with the arguments provided.

Returns NULL on failure

top
GetQuotaRoot
BOOL CkImapW_GetQuotaRoot(HCkImapW cHandle, const wchar_t *mailboxName, const wchar_t *outStr);
const wchar_t *CkImapW_getQuotaRoot(HCkImapW cHandle, const wchar_t *mailboxName);
Introduced in version 9.5.0.58

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.

More Information and Examples
top
GetQuotaRootAsync (1)
HCkTaskW CkImapW_GetQuotaRootAsync(HCkImapW cHandle, const wchar_t *mailboxName);
Introduced in version 9.5.0.58

Creates an asynchronous task to call the GetQuotaRoot method with the arguments provided.

Returns NULL on failure

top
GetServerCert
BOOL CkImapW_GetServerCert(HCkImapW cHandle, HCkCertW cert);
Introduced in version 11.0.0

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.

top
HasCapability
BOOL CkImapW_HasCapability(HCkImapW cHandle, const wchar_t *name, const wchar_t *capabilityResponse);
Introduced in version 9.5.0.58

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.

More Information and Examples
top
IdleCheck
BOOL CkImapW_IdleCheck(HCkImapW cHandle, int timeoutMs, const wchar_t *outStr);
const wchar_t *CkImapW_idleCheck(HCkImapW cHandle, int timeoutMs);
Introduced in version 9.5.0.26

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.

More Information and Examples
top
IdleCheckAsync (1)
HCkTaskW CkImapW_IdleCheckAsync(HCkImapW cHandle, int timeoutMs);
Introduced in version 9.5.0.26

Creates an asynchronous task to call the IdleCheck method with the arguments provided.

Returns NULL on failure

top
IdleDone
BOOL CkImapW_IdleDone(HCkImapW cHandle);
Introduced in version 9.5.0.26

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.

More Information and Examples
top
IdleDoneAsync (1)
HCkTaskW CkImapW_IdleDoneAsync(HCkImapW cHandle);
Introduced in version 9.5.0.26

Creates an asynchronous task to call the IdleDone method with the arguments provided.

Returns NULL on failure

top
IdleStart
BOOL CkImapW_IdleStart(HCkImapW cHandle);
Introduced in version 9.5.0.26

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.

More Information and Examples
top
IdleStartAsync (1)
HCkTaskW CkImapW_IdleStartAsync(HCkImapW cHandle);
Introduced in version 9.5.0.26

Creates an asynchronous task to call the IdleStart method with the arguments provided.

Returns NULL on failure

top
IsConnected
BOOL CkImapW_IsConnected(HCkImapW cHandle);

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.

top
IsLoggedIn
BOOL CkImapW_IsLoggedIn(HCkImapW cHandle);

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.

top
LoadTaskCaller
BOOL CkImapW_LoadTaskCaller(HCkImapW cHandle, HCkTaskW task);
Introduced in version 9.5.0.80

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.

top
Login
BOOL CkImapW_Login(HCkImapW cHandle, const wchar_t *loginName, const wchar_t *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.

top
LoginAsync (1)
HCkTaskW CkImapW_LoginAsync(HCkImapW cHandle, const wchar_t *loginName, const wchar_t *password);

Creates an asynchronous task to call the Login method with the arguments provided.

Returns NULL on failure

top
LoginSecure
BOOL CkImapW_LoginSecure(HCkImapW cHandle, HCkSecureStringW loginName, HCkSecureStringW password);
Introduced in version 9.5.0.71

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.

top
LoginSecureAsync (1)
HCkTaskW CkImapW_LoginSecureAsync(HCkImapW cHandle, HCkSecureStringW loginName, HCkSecureStringW password);
Introduced in version 9.5.0.71

Creates an asynchronous task to call the LoginSecure method with the arguments provided.

Returns NULL on failure

top
Logout
BOOL CkImapW_Logout(HCkImapW cHandle);

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.

top
LogoutAsync (1)
HCkTaskW CkImapW_LogoutAsync(HCkImapW cHandle);

Creates an asynchronous task to call the Logout method with the arguments provided.

Returns NULL on failure

top
MbxList
BOOL CkImapW_MbxList(HCkImapW cHandle, BOOL subscribed, const wchar_t *reference, const wchar_t *mbxPattern, HCkMailboxesW mboxes);
Introduced in version 11.0.0

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 under INBOX. on a server using . as its delimiter.

The method also updates SeparatorChar from the server's response.

Returns TRUE for success, FALSE for failure.

top
MbxListAsync (1)
HCkTaskW CkImapW_MbxListAsync(HCkImapW cHandle, BOOL subscribed, const wchar_t *reference, const wchar_t *mbxPattern, HCkMailboxesW mboxes);
Introduced in version 11.0.0

Creates an asynchronous task to call the MbxList method with the arguments provided.

Returns NULL on failure

top
MoveMessages
BOOL CkImapW_MoveMessages(HCkImapW cHandle, HCkMessageSetW messageSet, const wchar_t *destFolder);
Introduced in version 9.5.0.64

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.

top
MoveMessagesAsync (1)
HCkTaskW CkImapW_MoveMessagesAsync(HCkImapW cHandle, HCkMessageSetW messageSet, const wchar_t *destFolder);
Introduced in version 9.5.0.64

Creates an asynchronous task to call the MoveMessages method with the arguments provided.

Returns NULL on failure

top
Noop
BOOL CkImapW_Noop(HCkImapW cHandle);

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.

top
NoopAsync (1)
HCkTaskW CkImapW_NoopAsync(HCkImapW cHandle);

Creates an asynchronous task to call the Noop method with the arguments provided.

Returns NULL on failure

top
QueryMbx
BOOL CkImapW_QueryMbx(HCkImapW cHandle, const wchar_t *criteria, BOOL bUid, HCkMessageSetW msgSet);
Introduced in version 11.0.0

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.

More Information and Examples
top
QueryMbxAsync (1)
HCkTaskW CkImapW_QueryMbxAsync(HCkImapW cHandle, const wchar_t *criteria, BOOL bUid, HCkMessageSetW msgSet);
Introduced in version 11.0.0

Creates an asynchronous task to call the QueryMbx method with the arguments provided.

Returns NULL on failure

top
QueryThread
BOOL CkImapW_QueryThread(HCkImapW cHandle, const wchar_t *threadAlg, const wchar_t *searchCriteria, BOOL bUid, HCkJsonObjectW json);
Introduced in version 11.0.0

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.

top
QueryThreadAsync (1)
HCkTaskW CkImapW_QueryThreadAsync(HCkImapW cHandle, const wchar_t *threadAlg, const wchar_t *searchCriteria, BOOL bUid, HCkJsonObjectW json);
Introduced in version 11.0.0

Creates an asynchronous task to call the QueryThread method with the arguments provided.

Returns NULL on failure

top
RawCommandBd
BOOL CkImapW_RawCommandBd(HCkImapW cHandle, HCkBinDataW bdCmd, HCkBinDataW bdResp);
Introduced in version 11.0.0

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.

top
RawCommandBdAsync (1)
HCkTaskW CkImapW_RawCommandBdAsync(HCkImapW cHandle, HCkBinDataW bdCmd, HCkBinDataW bdResp);
Introduced in version 11.0.0

Creates an asynchronous task to call the RawCommandBd method with the arguments provided.

Returns NULL on failure

top
RefetchMailFlags
BOOL CkImapW_RefetchMailFlags(HCkImapW cHandle, HCkEmailW email);

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.

top
RefetchMailFlagsAsync (1)
HCkTaskW CkImapW_RefetchMailFlagsAsync(HCkImapW cHandle, HCkEmailW email);

Creates an asynchronous task to call the RefetchMailFlags method with the arguments provided.

Returns NULL on failure

top
RenameMailbox
BOOL CkImapW_RenameMailbox(HCkImapW cHandle, const wchar_t *fromMailbox, const wchar_t *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.

top
RenameMailboxAsync (1)
HCkTaskW CkImapW_RenameMailboxAsync(HCkImapW cHandle, const wchar_t *fromMailbox, const wchar_t *toMailbox);

Creates an asynchronous task to call the RenameMailbox method with the arguments provided.

Returns NULL on failure

top
SelectMailbox
BOOL CkImapW_SelectMailbox(HCkImapW cHandle, const wchar_t *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.

More Information and Examples
top
SelectMailboxAsync (1)
HCkTaskW CkImapW_SelectMailboxAsync(HCkImapW cHandle, const wchar_t *mailbox);

Creates an asynchronous task to call the SelectMailbox method with the arguments provided.

Returns NULL on failure

top
SendRawCommand
BOOL CkImapW_SendRawCommand(HCkImapW cHandle, const wchar_t *cmd, const wchar_t *outRawResponse);
const wchar_t *CkImapW_sendRawCommand(HCkImapW cHandle, const wchar_t *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.

More Information and Examples
top
SendRawCommandAsync (1)
HCkTaskW CkImapW_SendRawCommandAsync(HCkImapW cHandle, const wchar_t *cmd);

Creates an asynchronous task to call the SendRawCommand method with the arguments provided.

Returns NULL on failure

top
SetDecryptCert
BOOL CkImapW_SetDecryptCert(HCkImapW cHandle, HCkCertW cert);
Introduced in version 9.5.0.40

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.

top
SetDecryptCert2
BOOL CkImapW_SetDecryptCert2(HCkImapW cHandle, HCkCertW cert, HCkPrivateKeyW key);

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.

top
SetFlag
BOOL CkImapW_SetFlag(HCkImapW cHandle, unsigned long msgId, BOOL bUid, const wchar_t *flagName, int 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.

More Information and Examples
top
SetFlagAsync (1)
HCkTaskW CkImapW_SetFlagAsync(HCkImapW cHandle, unsigned long msgId, BOOL bUid, const wchar_t *flagName, int value);

Creates an asynchronous task to call the SetFlag method with the arguments provided.

Returns NULL on failure

top
SetFlags
BOOL CkImapW_SetFlags(HCkImapW cHandle, HCkMessageSetW messageSet, const wchar_t *flagName, int 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.

top
SetFlagsAsync (1)
HCkTaskW CkImapW_SetFlagsAsync(HCkImapW cHandle, HCkMessageSetW messageSet, const wchar_t *flagName, int value);

Creates an asynchronous task to call the SetFlags method with the arguments provided.

Returns NULL on failure

top
SetMailFlag
BOOL CkImapW_SetMailFlag(HCkImapW cHandle, HCkEmailW email, const wchar_t *flagName, int 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.

top
SetMailFlagAsync (1)
HCkTaskW CkImapW_SetMailFlagAsync(HCkImapW cHandle, HCkEmailW email, const wchar_t *flagName, int value);

Creates an asynchronous task to call the SetMailFlag method with the arguments provided.

Returns NULL on failure

top
SetQuota
BOOL CkImapW_SetQuota(HCkImapW cHandle, const wchar_t *quotaRoot, const wchar_t *resource, int quota);
Introduced in version 9.5.0.58

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.

top
SetQuotaAsync (1)
HCkTaskW CkImapW_SetQuotaAsync(HCkImapW cHandle, const wchar_t *quotaRoot, const wchar_t *resource, int quota);
Introduced in version 9.5.0.58

Creates an asynchronous task to call the SetQuota method with the arguments provided.

Returns NULL on failure

top
SetSslClientCert
BOOL CkImapW_SetSslClientCert(HCkImapW cHandle, HCkCertW cert);

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.

top
SetSslClientCertPem
BOOL CkImapW_SetSslClientCertPem(HCkImapW cHandle, const wchar_t *pemDataOrFilename, const wchar_t *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.

top
SetSslClientCertPfx
BOOL CkImapW_SetSslClientCertPfx(HCkImapW cHandle, const wchar_t *pfxFilename, const wchar_t *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.

top
SshAuthenticatePk
BOOL CkImapW_SshAuthenticatePk(HCkImapW cHandle, const wchar_t *sshLogin, HCkSshKeyW 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.

top
SshAuthenticatePkAsync (1)
HCkTaskW CkImapW_SshAuthenticatePkAsync(HCkImapW cHandle, const wchar_t *sshLogin, HCkSshKeyW privateKey);

Creates an asynchronous task to call the SshAuthenticatePk method with the arguments provided.

Returns NULL on failure

top
SshAuthenticatePw
BOOL CkImapW_SshAuthenticatePw(HCkImapW cHandle, const wchar_t *sshLogin, const wchar_t *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.

More Information and Examples
top
SshAuthenticatePwAsync (1)
HCkTaskW CkImapW_SshAuthenticatePwAsync(HCkImapW cHandle, const wchar_t *sshLogin, const wchar_t *sshPassword);

Creates an asynchronous task to call the SshAuthenticatePw method with the arguments provided.

Returns NULL on failure

top
SshCloseTunnel
BOOL CkImapW_SshCloseTunnel(HCkImapW cHandle);
Introduced in version 9.5.0.50

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.

top
SshCloseTunnelAsync (1)
HCkTaskW CkImapW_SshCloseTunnelAsync(HCkImapW cHandle);
Introduced in version 9.5.0.50

Creates an asynchronous task to call the SshCloseTunnel method with the arguments provided.

Returns NULL on failure

top
SshOpenTunnel
BOOL CkImapW_SshOpenTunnel(HCkImapW cHandle, const wchar_t *sshHostname, int sshPort);
Introduced in version 9.5.0.50

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.

More Information and Examples
top
SshOpenTunnelAsync (1)
HCkTaskW CkImapW_SshOpenTunnelAsync(HCkImapW cHandle, const wchar_t *sshHostname, int sshPort);
Introduced in version 9.5.0.50

Creates an asynchronous task to call the SshOpenTunnel method with the arguments provided.

Returns NULL on failure

top
StoreFlags
BOOL CkImapW_StoreFlags(HCkImapW cHandle, unsigned long msgId, BOOL bUid, const wchar_t *flagNames, int 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.

top
StoreFlagsAsync (1)
HCkTaskW CkImapW_StoreFlagsAsync(HCkImapW cHandle, unsigned long msgId, BOOL bUid, const wchar_t *flagNames, int value);

Creates an asynchronous task to call the StoreFlags method with the arguments provided.

Returns NULL on failure

top
Subscribe
BOOL CkImapW_Subscribe(HCkImapW cHandle, const wchar_t *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.

top
SubscribeAsync (1)
HCkTaskW CkImapW_SubscribeAsync(HCkImapW cHandle, const wchar_t *mailbox);

Creates an asynchronous task to call the Subscribe method with the arguments provided.

Returns NULL on failure

top
Unsubscribe
BOOL CkImapW_Unsubscribe(HCkImapW cHandle, const wchar_t *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.

top
UnsubscribeAsync (1)
HCkTaskW CkImapW_UnsubscribeAsync(HCkImapW cHandle, const wchar_t *mailbox);

Creates an asynchronous task to call the Unsubscribe method with the arguments provided.

Returns NULL on failure

top
UseCertVault
BOOL CkImapW_UseCertVault(HCkImapW cHandle, HCkXmlCertVaultW vault);
Introduced in version 9.5.0.40

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.

top
UseSsh
BOOL CkImapW_UseSsh(HCkImapW cHandle, HCkSshW ssh);
Introduced in version 9.5.0.55

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.

More Information and Examples
top
UseSshTunnel
BOOL CkImapW_UseSshTunnel(HCkImapW cHandle, HCkSocketW tunnel);
Introduced in version 9.5.0.50

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.

More Information and Examples
top

Deprecated

AddPfxSourceData Deprecated
BOOL CkImapW_AddPfxSourceData(HCkImapW cHandle, HCkByteData pfxBytes, const wchar_t *pfxPassword);
Introduced in version 9.5.0.46

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.

top
CheckForNewEmail
HCkMessageSetW CkImapW_CheckForNewEmail(HCkImapW cHandle);
This method is deprecated and replaced by QueryMbx

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 NULL on failure

top
CheckForNewEmailAsync (1) (2)
HCkTaskW CkImapW_CheckForNewEmailAsync(HCkImapW cHandle);
This method is deprecated and replaced by QueryMbx

Creates an asynchronous task to call the CheckForNewEmail method with the arguments provided.

Returns NULL on failure

top
FetchAttachmentBytes Deprecated
BOOL CkImapW_FetchAttachmentBytes(HCkImapW cHandle, HCkEmailW email, int attachIndex, const unsigned char * outBytes);

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.

top
FetchAttachmentBytesAsync Deprecated (1)
HCkTaskW CkImapW_FetchAttachmentBytesAsync(HCkImapW cHandle, HCkEmailW email, int attachIndex);

Creates an asynchronous task to call the FetchAttachmentBytes method with the arguments provided.

Returns NULL on failure

top
FetchBundle
HCkEmailBundleW CkImapW_FetchBundle(HCkImapW cHandle, HCkMessageSetW messageSet);
This method is deprecated and replaced by FetchMsgSet

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 NULL on failure

top
FetchBundleAsync (1) (2)
HCkTaskW CkImapW_FetchBundleAsync(HCkImapW cHandle, HCkMessageSetW messageSet);
This method is deprecated and replaced by FetchMsgSet

Creates an asynchronous task to call the FetchBundle method with the arguments provided.

Returns NULL on failure

top
FetchBundleAsMime
HCkStringArrayW CkImapW_FetchBundleAsMime(HCkImapW cHandle, HCkMessageSetW messageSet);
This method is deprecated.

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 NULL on failure

top
FetchBundleAsMimeAsync (1) (2)
HCkTaskW CkImapW_FetchBundleAsMimeAsync(HCkImapW cHandle, HCkMessageSetW messageSet);
This method is deprecated.

Creates an asynchronous task to call the FetchBundleAsMime method with the arguments provided.

Returns NULL on failure

top
FetchChunk
HCkEmailBundleW CkImapW_FetchChunk(HCkImapW cHandle, int startSeqNum, int count, HCkMessageSetW failedSet, HCkMessageSetW fetchedSet);
This method is deprecated and replaced by FetchRange

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 NULL on failure

top
FetchChunkAsync (1) (2)
HCkTaskW CkImapW_FetchChunkAsync(HCkImapW cHandle, int startSeqNum, int count, HCkMessageSetW failedSet, HCkMessageSetW fetchedSet);
This method is deprecated and replaced by FetchRange

Creates an asynchronous task to call the FetchChunk method with the arguments provided.

Returns NULL on failure

top
FetchHeaders
HCkEmailBundleW CkImapW_FetchHeaders(HCkImapW cHandle, HCkMessageSetW messageSet);
This method is deprecated and replaced by FetchMsgSet

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 NULL on failure

top
FetchHeadersAsync (1) (2)
HCkTaskW CkImapW_FetchHeadersAsync(HCkImapW cHandle, HCkMessageSetW messageSet);
This method is deprecated and replaced by FetchMsgSet

Creates an asynchronous task to call the FetchHeaders method with the arguments provided.

Returns NULL on failure

top
FetchSequence
HCkEmailBundleW CkImapW_FetchSequence(HCkImapW cHandle, int startSeqNum, int numMessages);
This method is deprecated and replaced by FetchRange

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 NULL on failure

top
FetchSequenceAsync (1) (2)
HCkTaskW CkImapW_FetchSequenceAsync(HCkImapW cHandle, int startSeqNum, int numMessages);
This method is deprecated and replaced by FetchRange

Creates an asynchronous task to call the FetchSequence method with the arguments provided.

Returns NULL on failure

top
FetchSequenceAsMime
HCkStringArrayW CkImapW_FetchSequenceAsMime(HCkImapW cHandle, int startSeqNum, int numMessages);
This method is deprecated.

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 NULL on failure

top
FetchSequenceAsMimeAsync (1) (2)
HCkTaskW CkImapW_FetchSequenceAsMimeAsync(HCkImapW cHandle, int startSeqNum, int numMessages);
This method is deprecated.

Creates an asynchronous task to call the FetchSequenceAsMime method with the arguments provided.

Returns NULL on failure

top
FetchSequenceHeaders
HCkEmailBundleW CkImapW_FetchSequenceHeaders(HCkImapW cHandle, int startSeqNum, int numMessages);
This method is deprecated and replaced by FetchRange

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 NULL on failure

top
FetchSequenceHeadersAsync (1) (2)
HCkTaskW CkImapW_FetchSequenceHeadersAsync(HCkImapW cHandle, int startSeqNum, int numMessages);
This method is deprecated and replaced by FetchRange

Creates an asynchronous task to call the FetchSequenceHeaders method with the arguments provided.

Returns NULL on failure

top
FetchSingle
HCkEmailW CkImapW_FetchSingle(HCkImapW cHandle, unsigned long msgId, BOOL bUid);
This method is deprecated and replaced by FetchEmail

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 NULL on failure

top
FetchSingleAsync (1) (2)
HCkTaskW CkImapW_FetchSingleAsync(HCkImapW cHandle, unsigned long msgId, BOOL bUid);
This method is deprecated and replaced by FetchEmail

Creates an asynchronous task to call the FetchSingle method with the arguments provided.

Returns NULL on failure

top
FetchSingleHeader
HCkEmailW CkImapW_FetchSingleHeader(HCkImapW cHandle, unsigned long msgId, BOOL bUid);
This method is deprecated and replaced by FetchEmail

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 NULL on failure

top
FetchSingleHeaderAsync (1) (2)
HCkTaskW CkImapW_FetchSingleHeaderAsync(HCkImapW cHandle, unsigned long msgId, BOOL bUid);
This method is deprecated and replaced by FetchEmail

Creates an asynchronous task to call the FetchSingleHeader method with the arguments provided.

Returns NULL on failure

top
GetAllUids
HCkMessageSetW CkImapW_GetAllUids(HCkImapW cHandle);
This method is deprecated and replaced by QueryMbx

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 NULL on failure

top
GetAllUidsAsync (1) (2)
HCkTaskW CkImapW_GetAllUidsAsync(HCkImapW cHandle);
This method is deprecated and replaced by QueryMbx

Creates an asynchronous task to call the GetAllUids method with the arguments provided.

Returns NULL on failure

top
GetSslServerCert
HCkCertW CkImapW_GetSslServerCert(HCkImapW cHandle);
This method is deprecated and replaced by GetServerCert

Deprecated: Use GetServerCert instead.

Returns the certificate presented by the IMAP server for the current TLS connection.

Returns NULL on failure

top
ListMailboxes
HCkMailboxesW CkImapW_ListMailboxes(HCkImapW cHandle, const wchar_t *reference, const wchar_t *wildcardedMailbox);
This method is deprecated and replaced by MbxList

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 NULL on failure

top
ListMailboxesAsync (1) (2)
HCkTaskW CkImapW_ListMailboxesAsync(HCkImapW cHandle, const wchar_t *reference, const wchar_t *wildcardedMailbox);
This method is deprecated and replaced by MbxList

Creates an asynchronous task to call the ListMailboxes method with the arguments provided.

Returns NULL on failure

top
ListSubscribed
HCkMailboxesW CkImapW_ListSubscribed(HCkImapW cHandle, const wchar_t *reference, const wchar_t *wildcardedMailbox);
This method is deprecated and replaced by MbxList

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 NULL on failure

top
ListSubscribedAsync (1) (2)
HCkTaskW CkImapW_ListSubscribedAsync(HCkImapW cHandle, const wchar_t *reference, const wchar_t *wildcardedMailbox);
This method is deprecated and replaced by MbxList

Creates an asynchronous task to call the ListSubscribed method with the arguments provided.

Returns NULL on failure

top
Search
HCkMessageSetW CkImapW_Search(HCkImapW cHandle, const wchar_t *criteria, BOOL bUid);
This method is deprecated and replaced by QueryMbx

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:

  • ALL
  • UNSEEN
  • FROM "sender@example.com"
  • SUBJECT "invoice"
  • SINCE 1-Jul-2026
  • UID 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 NULL on failure

top
SearchAsync (1) (2)
HCkTaskW CkImapW_SearchAsync(HCkImapW cHandle, const wchar_t *criteria, BOOL bUid);
This method is deprecated and replaced by QueryMbx

Creates an asynchronous task to call the Search method with the arguments provided.

Returns NULL on failure

top
SendRawCommandB Deprecated
BOOL CkImapW_SendRawCommandB(HCkImapW cHandle, const wchar_t *cmd, const unsigned char * outBytes);

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.

top
SendRawCommandBAsync Deprecated (1)
HCkTaskW CkImapW_SendRawCommandBAsync(HCkImapW cHandle, const wchar_t *cmd);

Creates an asynchronous task to call the SendRawCommandB method with the arguments provided.

Returns NULL on failure

top
SendRawCommandC Deprecated
BOOL CkImapW_SendRawCommandC(HCkImapW cHandle, HCkByteData cmd, const unsigned char * outBytes);

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.

top
SendRawCommandCAsync Deprecated (1)
HCkTaskW CkImapW_SendRawCommandCAsync(HCkImapW cHandle, HCkByteData cmd);

Creates an asynchronous task to call the SendRawCommandC method with the arguments provided.

Returns NULL on failure

top
Sort
HCkMessageSetW CkImapW_Sort(HCkImapW cHandle, const wchar_t *sortCriteria, const wchar_t *charset, const wchar_t *searchCriteria, BOOL bUid);
Introduced in version 9.5.0.76
This method is deprecated and replaced by QueryMbx

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 NULL on failure

More Information and Examples
top
SortAsync (1) (2)
HCkTaskW CkImapW_SortAsync(HCkImapW cHandle, const wchar_t *sortCriteria, const wchar_t *charset, const wchar_t *searchCriteria, BOOL bUid);
Introduced in version 9.5.0.76
This method is deprecated and replaced by QueryMbx

Creates an asynchronous task to call the Sort method with the arguments provided.

Returns NULL on failure

top
ThreadCmd
HCkJsonObjectW CkImapW_ThreadCmd(HCkImapW cHandle, const wchar_t *threadAlg, const wchar_t *charset, const wchar_t *searchCriteria, BOOL bUid);
Introduced in version 9.5.0.77
This method is deprecated and replaced by QueryThread

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 NULL on failure

top
ThreadCmdAsync (1) (2)
HCkTaskW CkImapW_ThreadCmdAsync(HCkImapW cHandle, const wchar_t *threadAlg, const wchar_t *charset, const wchar_t *searchCriteria, BOOL bUid);
Introduced in version 9.5.0.77
This method is deprecated and replaced by QueryThread

Creates an asynchronous task to call the ThreadCmd method with the arguments provided.

Returns NULL on failure

top