EmailBundle C Library Reference

EmailBundle

Represents a collection of Email objects.

Create/Dispose

HCkEmailBundle CkEmailBundle_Create(void);

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

void CkEmailBundle_Dispose(HCkEmailBundle handle);

Objects created by calling CkEmailBundle_Create must be freed by calling this method. A memory leak occurs if a handle is not disposed by calling this function.

C "Properties"

void CkEmailBundle_getLastErrorHtml(HCkEmailBundle handle, HCkString retval);

Error information in HTML format for the last method called.

void CkEmailBundle_getLastErrorText(HCkEmailBundle handle, HCkString retval);

Error information in plain-text format for the last method called.

void CkEmailBundle_getLastErrorXml(HCkEmailBundle handle, HCkString retval);

Error information in XML format for the last method called.

long CkEmailBundle_getMessageCount(HCkEmailBundle handle);

The number of emails in this bundle.

BOOL CkEmailBundle_getUtf8(HCkEmailBundle handle);
void CkEmailBundle_putUtf8(HCkEmailBundle handle, BOOL newVal);

When set to true, all "const char *" arguments are expected to be utf-8 strings. If set to false, the "const char *" arguments are expected to be ANSI strings.

C "Methods"

BOOL CkEmailBundle_AddEmail(HCkEmailBundle handle, HCkEmail email);

Adds an Email object to the bundle. Returns true if successful

HCkEmail CkEmailBundle_FindByHeader(HCkEmailBundle handle, const char *name, const char *value);

To be documented soon...

HCkEmail CkEmailBundle_GetEmail(HCkEmailBundle handle, long index);

Returns the Nth Email in the bundle.

Returns a null reference on failure

HCkStringArray CkEmailBundle_GetUidls(HCkEmailBundle handle);

Returns a StringArray object containing UIDLs for all Email objects in the bundle. UIDLs are only valid for emails retrieved from POP3 servers. An email on a POP3 server has a "UIDL", an email on IMAP servers has a "UID". If the email was retrieved from an IMAP server, the UID will be accessible via the "ckx-imap-uid" header field.

Returns a null reference on failure

void CkEmailBundle_GetXml(HCkEmailBundle handle, HCkString sbXml);

Converts the email bundle to an XML document in memory. Returns the XML document as a string.

BOOL CkEmailBundle_LoadXml(HCkEmailBundle handle, const char *filename);

Loads an email bundle from an XML file.

BOOL CkEmailBundle_LoadXmlString(HCkEmailBundle handle, const char *xmlStr);

Loads an email bundle from an XML string.

BOOL CkEmailBundle_RemoveEmail(HCkEmailBundle handle, HCkEmail email);

Removes an email from the bundle. This does not remove the email from the mail server.

BOOL CkEmailBundle_RemoveEmailByIndex(HCkEmailBundle handle, int index);

Removes the Nth email in a bundle. (Indexing begins at 0.)

Returns TRUE for success, FALSE for failure.

BOOL CkEmailBundle_SaveLastError(HCkEmailBundle handle, const char *filename);

Saves the last error information to an XML formatted file.

BOOL CkEmailBundle_SaveXml(HCkEmailBundle handle, const char *filename);

Converts each email to XML and persists the bundle to an XML file. The email bundle can later be re-instantiated by calling MailMan.LoadXmlFile

void CkEmailBundle_SortByDate(HCkEmailBundle handle, BOOL ascending);

Sorts emails in the bundle by date.

void CkEmailBundle_SortByRecipient(HCkEmailBundle handle, BOOL ascending);

Sorts emails in the bundle by recipient.

void CkEmailBundle_SortBySender(HCkEmailBundle handle, BOOL ascending);

Sorts emails in the bundle by sender.

void CkEmailBundle_SortBySubject(HCkEmailBundle handle, BOOL ascending);

Sorts emails in the bundle by subject.

const char *CkEmailBundle_getXml(HCkEmailBundle handle);

Converts the email bundle to an XML document in memory. Returns the XML document as a string.

const char *CkEmailBundle_lastErrorHtml(HCkEmailBundle handle);

Error information in HTML format for the last method called.

const char *CkEmailBundle_lastErrorText(HCkEmailBundle handle);

Error information in plain-text format for the last method called.

const char *CkEmailBundle_lastErrorXml(HCkEmailBundle handle);

Error information in XML format for the last method called.