CkEmail C++ Class Reference (Visual C++)

CkEmail

Represents a complete Email object.

Properties

void get_Body(CkString &str);
void put_Body(const char *str);

The body of the email. If the email has both HTML and plain-text bodies, this property returns the HTML body. The GetHtmlBody and GetPlainTextBody methods can be used to access a specific body. The HasHtmlBody and HasPlainTextBody methods can be used to determine the presence of a body.

void get_BounceAddress(CkString &str);
void put_BounceAddress(const char *str);

The "return-path" address of the email. Bounces will go to this address.

void get_Charset(CkString &str);
void put_Charset(const char *str);

Sets the charset for the entire email. The header fields and plain-text/HTML bodies will be converted and sent in this charset. (This includes parsing and updating the HTML with the appropriate META tag specifying the charset.) All formatting and encoding of the email MIME is handled automatically by the Chilkat Mail component. If your application wants to send a Shift_JIS email, you simply set the Charset property to "Shift_JIS". Note: If a charset property is not explicitly set, the Chilkat component automatically detects the charset and chooses the appropriate charset. If all characters are 7bit (i.e. us-ascii) the charset is left blank. If the email contain a mix of languages such that no one charset can be chosen, or if the language cannot be determined without ambiguity, then the "utf-8" charset will be chosen.

bool get_Decrypted(void);

true if the email arrived encrypted and was successfully decrypted, otherwise false.

void get_EmailDate(SYSTEMTIME &sysTime);
void put_EmailDate(SYSTEMTIME &sysTime);

The date and time in UTC/GMT standard. Use the LocalDate property to get the local date and time.

void get_EncryptedBy(CkString &str);

If the email was received encrypted, this contains the details of the certificate used for encryption.

void get_FileDistList(CkString &str);
void put_FileDistList(const char *str);

Set this property to send an email to a list of recipients stored in a plain text file. The file format is simple: one recipient per line, no comments allowed, blank lines are ignored.Setting this property is equivalent to adding a "CKX-FileDistList"header field to the email. Chilkat Mail treats header fields beginning with "CKX-"specially in that these fields are never transmitted with the email when sent. However, CKX fields are saved and restored when saving to XML or loading from XML (or MIME). When sending an email containing a "CKX-FileDistList"header field, Chilkat Mail will read the distribution list file and send the email to each recipient. Emails can be sent individually, or with BCC, 100 recipients at a time. (see the MailMan.SendIndividual property).

void get_From(CkString &str);
void put_From(const char *str);

The combined name and email address of the sender, such as "John Smith"

void get_FromAddress(CkString &str);
void put_FromAddress(const char *str);

The email address of the sender.

void get_FromName(CkString &str);
void put_FromName(const char *str);

The name of the sender.

void get_Header(CkString &str);

The complete MIME header of the email.

void get_Language(CkString &str);

(PreRelease) A read-only property that identifies the primary language group for the email. Possible values are:

  • "latin1" (for English and all Western European languages)
  • "central" (for Central European languages such as Polish, Czech, Hungarian, etc.)
  • "russian" (for Cyrillic languages)
  • "greek"
  • "turkish"
  • "hebrew"
  • "arabic"
  • "baltic"
  • "thai"
  • "vietnamese"
  • "chinese"
  • "japanese"
  • "korean"
  • "unknown"
The language group determination is made soley on the subject and plain-text/HTML email bodies. Characters in the FROM, TO, CC, and other header fields are not considered.

The primary determining factor is the characters found in the Subject header field. For example, if an email contains Japanese in the Subject, but the body contains Russian characters, it will be considered "japanese".

void LastErrorHtml(CkString &str);

Error information in HTML format for the last method called.

void LastErrorText(CkString &str);

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

void LastErrorXml(CkString &str);

Error information in XML format for the last method called.

void get_LocalDate(SYSTEMTIME &sysTime);
void put_LocalDate(SYSTEMTIME &sysTime);

The local date and time of when the email was sent or created.

void get_Mailer(CkString &str);
void put_Mailer(const char *str);

Identifies the email software that sent the email.

long get_NumAlternatives(void);

The number of alternative bodies present in the email. An email that is not "multipart/alternative"will return 0 alternatives. An email that is "multipart/alternative" will return a number greater than or equal to 1.

long get_NumAttachedMessages(void);

Returns the number of embedded emails. Some mail clients will embed an email that is to be forwarded into a new email as a "message/rfc822" subpart of the MIME message structure. This property tells how many emails have been embedded. The original email can be retrieved by calling GetAttachedMessage.

More about Attached Email Messages

long get_NumAttachments(void) const;

The number of attachments contained in the email.

long get_NumBcc(void);

The number of blind carbon-copy email recipients.

long get_NumCC(void);

The number of carbon-copy email recipients.

long get_NumHeaderFields(void);

The number of header fields.

long get_NumRelatedItems(void);

The number of related items present in this email. Related items are typically image files (JPEGs or GIFs) or style sheets (CSS files) that are included with HTML formatted messages with internal "CID"hyperlinks.

long get_NumReplacePatterns(void);

Returns the number of replacement patterns previously set by calling the SetReplacePattern method 1 or more times. If replacement patterns are set, the email bodies and header fields are modified by applying the search/replacement strings during the message sending process.

long get_NumTo(void);

The number of direct email recipients.

bool get_OverwriteExisting(void);
void put_OverwriteExisting(bool newVal);

When true (the default) the methods to save email attachments will overwrite files if they already exist. If false, then the methods that save email attachments will append a string of 4 characters to create a unique filename if a file already exists. The filename of the attachment within the email object is updated and can be retrieved by the program to determine the actual file(s) created.

bool get_ReceivedEncrypted(void);

true if this email was originally received with encryption, otherwise false.

bool get_ReceivedSigned(void);

true if this email was originally received with a digital signature, otherwise false.

void get_ReplyTo(CkString &str);
void put_ReplyTo(const char *str);

The email address to be used when a recipient replies.

bool get_ReturnReceipt(void);
void put_ReturnReceipt(bool newVal);

Set to true if you want the email to request a return-receipt when received by the recipient. The default value is false.

bool get_SendEncrypted(void);
void put_SendEncrypted(bool newVal);

Set to true if this email should be sent encrypted.

Auto-Select Cert and Send Encrypted Email

Using a .cer Certificate File for Encrypted Email

Select Cert for Encrypted Email

bool get_SendSigned(void);
void put_SendSigned(bool newVal);

Set to true if this email should be sent with a digital signature.

bool get_SignaturesValid(void);

true if the email was received with one or more digital signatures, and if all the signatures were validated indicating that the email was not altered. Otherwise this property is set to false.

void get_SignedBy(CkString &str);

If the email was received digitally signed, this property contains the details of the signer.

long get_Size(void);

The size in bytes of the email, including all parts and attachments.

void get_Subject(CkString &str);
void put_Subject(const char *str);

The email subject.

void get_Uidl(CkString &str);

This is the unique ID assigned by the POP3 server. Emails can be retrieved or deleted from the POP3 server via the UIDL. The header field for this property is "X-UIDL".

bool get_Utf8(void) const;
void put_Utf8(bool b);

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.

Methods

void AddAttachmentHeader(int index, const char * fieldName, const char * fieldValue);

Adds a MIME header field to one of the attachments.

bool AddBcc(const char * friendlyName, const char * emailAddress);

Adds a recipient to the blind carbon-copy list. address is required, but name may be empty. Returns True if successful.

Why BCC email addresses do not appear in the email header.

bool AddCC(const char * friendlyName, const char * emailAddress);

Adds a recipient to the carbon-copy list. address is required, but name may be empty. Returns True if successful.

bool AddDataAttachment(const char * fileName, const unsigned char * data, unsigned long dataLen);

Adds an attachment directly from data in memory to the email.

bool AddDataAttachment2(const char * fileName, CkByteData & content, const char * contentType);

Adds an attachment to an email from in-memory data. Same as AddDataAttachment but allows the content-type to be specified.

bool AddFileAttachment(const char * fileName, CkString * strContentType);

Adds a file as an attachment to the email. Returns the MIME content-type of the attachment, which is inferred based on the filename extension.

bool AddFileAttachment(const char * fileName, CkString & strContentType);

Adds a file as an attachment to the email. Returns the MIME content-type of the attachment, which is inferred based on the filename extension.

Returns true for success, false for failure.

bool AddFileAttachment2(const char * fileName, const char * contentType);

Same as AddFileAttachment, but the content type can be explicitly specified.

void AddHeaderField(const char * fieldName, const char * fieldValue);

Any standard or non-standard (custom) header field can be added to the email with this method. One interesting feature is that all header fields whose name begins with "CKX-" will not be included in the header when an email is sent. These fields will be included when saved to or loaded from XML. This makes it easy to include persistent meta-data with an email which your programs can use in any way it chooses.

bool AddHtmlAlternativeBody(const char * body);

Sets the HTML body of the email. Use this method if there will be multiple versions of the body, but in different formats, such as HTML and plain text. Otherwise, set the body by calling the SetHtmlBody method.

bool AddMultipleBcc(const char * commaSeparatedAddresses);

Adds multiple recipients to the blind carbon-copy list. The parameter is a string containing a comma separated list of full email addresses. Returns True if successful.

Why BCC email addresses do not appear in the email header.

bool AddMultipleCC(const char * commaSeparatedAddresses);

Adds multiple recipients to the carbon-copy list. The parameter is a string containing a comma separated list of full email addresses. Returns True if successful.

bool AddMultipleTo(const char * commaSeparatedAddresses);

Adds multiple recipients to the "to" list. The parameter is a string containing a comma separated list of full email addresses. Returns True if successful.

bool AddPlainTextAlternativeBody(const char * body);

Sets the plain-text body of the email. Use this method if there will be multiple versions of the body, but in different formats, such as HTML and plain text. Otherwise, simply set the Body property.

bool AddRelatedData(const char * nameInHtml, const unsigned char * data, unsigned long dataLen, CkString * strContentId);

Adds the memory data as a related item to the email and returns the Content-ID. Emails formatted in HTML can include images with this call and internally reference the image through a "cid"hyperlink. (Chilkat Email.NET fully supports the MHTML standard.)

bool AddRelatedData(const char * nameInHtml, const unsigned char * data, unsigned long dataLen, CkString & strContentId);

Adds the memory data as a related item to the email and returns the Content-ID. Emails formatted in HTML can include images with this call and internally reference the image through a "cid"hyperlink. (Chilkat Email.NET fully supports the MHTML standard.)

Returns true for success, false for failure.

void AddRelatedData2(const unsigned char * data, unsigned long dataLen, const char * fileNameInHtml);

Adds a related item to the email from in-memory byte data. Related items are things such as images and style sheets that are embedded within an HTML email. They are not considered attachments because their sole purpose is to participate in the display of the HTML. This method differs from AddRelatedData in that it does not use or return a Content-ID. The filename argument should be set to the filename used in the HTML img tag's src attribute (if it's an image), or the URL referenced in an HTML link tag for a stylesheet.

bool AddRelatedFile(const char * fileName, CkString * strContentID);

Adds the contents of a file to the email and returns the Content-ID. Emails formatted in HTML can include images with this call and internally reference the image through a "cid" hyperlink. (Chilkat Email.NET fully supports the MHTML standard.)

bool AddRelatedFile(const char * fileName, CkString & strContentID);

Adds the contents of a file to the email and returns the Content-ID. Emails formatted in HTML can include images with this call and internally reference the image through a "cid" hyperlink. (Chilkat Email.NET fully supports the MHTML standard.)

Returns true for success, false for failure.

bool AddRelatedFile2(const char * fileNameOnDisk, const char * filenameInHtml);

Adds a related item to the email from a file. Related items are things such as images and style sheets that are embedded within an HTML email. They are not considered attachments because their sole purpose is to participate in the display of the HTML. This method differs from AddRelatedFile in that it does not use or return a Content-ID. The filenameInHtml argument should be set to the filename used in the HTML img tag's src attribute (if it's an image), or the URL referenced in an HTML link tag for a stylesheet.

bool AddRelatedString(const char * nameInHtml, const char * str, const char * charset, CkString * cid);

Adds a related item to the email. A related item is typically an image or style sheet referenced by an HTML tag within the HTML email body. The contents of the related item are passed str. nameInHtml specifies the filename that should be used within the HTML, and not an actual filename on the local filesystem. charset specifies the charset that should be used for the text content of the related item. Returns the content-ID generated for the added item.

bool AddRelatedString(const char * nameInHtml, const char * str, const char * charset, CkString & cid);

Adds a related item to the email. A related item is typically an image or style sheet referenced by an HTML tag within the HTML email body. The contents of the related item are passed str. nameInHtml specifies the filename that should be used within the HTML, and not an actual filename on the local filesystem. charset specifies the charset that should be used for the text content of the related item. Returns the content-ID generated for the added item.

Returns true for success, false for failure.

void AddRelatedString2(const char * str, const char * charset, const char * filenameInHtml);

Adds a related item to the email from an in-memory string. Related items are things such as images and style sheets that are embedded within an HTML email. They are not considered attachments because their sole purpose is to participate in the display of the HTML. The filenameInHtml argument should be set to the filename used in the HTML img tag's src attribute (if it's an image), or the URL referenced in an HTML link tag for a stylesheet. The charset argument indicates that the content should first be converted to the specified charset prior to adding to the email. It should hava a value such as "iso-8859-1", "utf-8", "Shift_JIS", etc.

bool AddStringAttachment(const char * fileName, const char * str);

Adds an attachment directly from a string in memory to the email.

bool AddStringAttachment2(const char * fileName, const char * str, const char * charset);

Adds an attachment to an email. The filename argument specifies the filename to be used for the attachment and is not an actual filename existing on the local filesystem. The "str" argument contains the text data for the attachment. The string will be converted to the charset specified in the last argument before being added to the email.

bool AddTo(const char * friendlyName, const char * emailAddress);

Adds a recipient to the "to" list. address is required, but name may be empty. Returns True if successful. Emails that have no "To" recipients will be sent to .

bool AesDecrypt(const char * password);

Decrypts and restores an email message that was previously encrypted using AesEncrypt. The password must match the password used for encryption.

bool AesEncrypt(const char * password);

Encrypts the email body, all alternative bodies, all message sub-parts and attachments using 128-bit AES (Rijndael, CBC mode) encryption. To decrypt, you must use the AesDecrypt method with the same password. The AesEncrypt/Decrypt methods use symmetric password-based greatly simplify sending and receiving encrypted emails because certificates and public/private key issues do not have to be dealt with. However, the sending and receiving applications must both be using Chilkat Email .NET or ActiveX components.

void AppendToBody(const char * str);

Appends a string to the plain-text body.

bool AspUnpack(const char * prefix, const char * saveDir, const char * urlPath, bool cleanFiles);

(PreRelease) To be documented soon.

Returns true for success, false for failure.

bool AspUnpack2(const char * prefix, const char * saveDir, const char * urlPath, bool cleanFiles, CkByteData & outHtml);

(PreRelease) To be documented soon.

bool BEncodeBytes(const unsigned char * data, unsigned long dataLen, const char * charset, CkString & encodedStr);

Takes a byte array of multibyte (non-Unicode) data and returns a Unicode B-Encoded string.

Returns true for success, false for failure.

bool BEncodeString(const char * str, const char * charset, CkString & encodedStr);

Takes a Unicode string, converts it to the charset specified in the 2nd parameter, B-Encodes the converted multibyte data, and returns the encoded Unicode string.

Returns true for success, false for failure.

void ClearBcc();

Clears the list of blind carbon-copy recipients.

void ClearCC();

Clears the list of carbon-copy recipients.

void ClearTo();

Clears the list of "to" recipients.

CkEmail * Clone();

Creates and returns an identical copy of the Email object.

Returns a null reference on failure

CkEmail * CreateForward();

Returns a copy of the Email object with the body and header fields changed so that the newly created email can be forwarded. After calling CreateForward, simply add new recipients to the created email, and call MailMan.SendEmail.

Returns a null reference on failure

CkEmail * CreateReply();

Returns a copy of the Email object with the body and header fields changed so that the newly created email can be sent as a reply. After calling CreateReply, simply prepend additional information to the body, and call MailMan.SendEmail.

Returns a null reference on failure

bool CreateTempMht(const char * inFilename, CkString & tempMhtFilenameInOut);

Saves the email to a temporary MHT file so that a WebBrowser control can navigate to it and display it. If fileName is empty, a temporary filename is generated and returned. If fileName is non-empty, then it will be created or overwritten, and the input filename is simply returned.The MHT file that is created will not contain any of the email's attachments, if any existed. Also, if the email was plain-text, the MHT file will be saved such that the plain-text is converted to HTML using pre-formatted text ("pre" HTML tags) allowing it to be displayed correctly in a WebBrowser.

Returns true for success, false for failure.

CkMime * * Decompose(int & numParts);

Returns the MIME subparts of a multipart email in a flattened array of Mime objects. (Note: the Chilkat MIME .NET class must be licensed in order to use the Mime object.)

void DropAttachments();

Removes all attachments from the email.

void DropRelatedItem(long index);

A related item is typically an embedded image referenced from the HTML in the email via a "CID" hyperlink. This method removes the Nth embedded image from the email. Note: If the HTML tries to reference the removed image, it will be displayed as a broken image link.

void DropRelatedItems();

A related item is typically an embedded image referenced from the HTML in the email via a "CID" hyperlink. This method removes all the embedded images from the email.

bool DropSingleAttachment(long index);

Drops a single attachment from the email. Returns True if successful.

void GenerateFilename(CkString & strFilename);

Generates a unique filename for this email. The filename will be different each time the method is called.

Returns true for success, false for failure.

bool GetAltHeaderField(int index, const char * fieldName, CkString & outStr);

Returns the value of a header field within the Nth alternative body's MIME sub-part.

Returns true for success, false for failure.

bool GetAlternativeBody(long index, CkString & strBody);

Returns the Nth alternative body. The NumAlternatives property tells the number of alternative bodies present. Use the GetHtmlBody and GetPlainTextBody methods to easily get the HTML or plain text alternative bodies.

Returns true for success, false for failure.

bool GetAlternativeContentType(long index, CkString & strContentType);

Returns the content type of the Nth alternative body. The NumAlternatives property tells the number of alternative bodies present.

Returns true for success, false for failure.

CkEmail * GetAttachedMessage(long index);

Returns an embedded "message/rfc822" subpart as an email object. (Emails are embedded as "message/rfc822" subparts by some mail clients when forwarding an email.) This method allows the original email to be accessed.

Returns a null reference on failure

bool GetAttachedMessageFilename(int index, CkString & outStr);

Returns the filename of the Nth attached (embedded) email. The filename is the "filename" attribute of the content-disposition header field found within the Nth message/rfc822 sub-part of the calling email object.

Returns true for success, false for failure.

bool GetAttachmentContentID(long index, CkString & strContentID);

Returns the ContentID header field for the Nth attachment. The first attachment is at index 0.

Returns true for success, false for failure.

bool GetAttachmentContentType(long index, CkString & strContentType);

Returns the Content-Type header field for the Nth attachment. Indexing of attachments begins at 0.

Returns true for success, false for failure.

bool GetAttachmentData(long index, CkByteData & buffer);

Retrieves an attachment's binary data for in-memory access.

bool GetAttachmentFilename(long index, CkString & strFilename);

Retrieves an attachment's filename.

Returns true for success, false for failure.

bool GetAttachmentHeader(long index, const char * fieldName, CkString & fieldValue);

Returns the value of a header field (by name) of an attachment.

Returns true for success, false for failure.

long GetAttachmentSize(long index);

Returns the size (in bytes) of the Nth attachment.

bool GetAttachmentString(long index, const char * charset, CkString & str);

Retrieves an attachment's data as a String. All CRLF sequences will be translated to single newline characters.

Returns true for success, false for failure.

bool GetAttachmentStringCrLf(long index, const char * charset, CkString & strData);

Retrieves an attachment's data as a String. All end-of-lines will be translated to CRLF sequences.

Returns true for success, false for failure.

bool GetBcc(long index, CkString & str);

Returns a blind carbon-copy recipient's full email address.

Returns true for success, false for failure.

bool GetBccAddr(long index, CkString & str);

Returns the Nth BCC address (only the address part, not the friendly-name part).

Returns true for success, false for failure.

bool GetBccName(long index, CkString & str);

Returns the Nth BCC name (only the friendly-name part, not the address part).

Returns true for success, false for failure.

bool GetCC(long index, CkString & str);

Returns a carbon-copy recipient's full email address.

Returns true for success, false for failure.

bool GetCcAddr(long index, CkString & str);

Returns the Nth CC address (only the address part, not the friendly-name part).

Returns true for success, false for failure.

bool GetCcName(long index, CkString & str);

Returns the Nth CC name (only the friendly-name part, not the address part).

Returns true for success, false for failure.

bool GetDeliveryStatusInfo(const char * fieldName, CkString & fieldValue);

If the email is a multipart/report, then it is a delivery status notification. This method can be used to get individual pieces of information from the message/delivery-status part of the email. This method should only be called if the IsMultipartReport method returns true.

The fieldName should be set a string such as "Final-Recipient", "Status", "Action", "Reporting-MTA", etc.

Reporting-MTA: dns; XYZ.abc.nl

Final-recipient: RFC822; someEmailAddr@doesnotexist123.nl
Action: failed
Status: 5.4.4
X-Supplementary-Info: < #5.4.4 smtp;554 5.4.4
 SMTPSEND.DNS.NonExistentDomain; nonexistent domain>

Returns true for success, false for failure.

CkCert * GetEncryptCert();

Returns the certificate that was previously set by SetEncryptCert.

CkCert * GetEncryptedByCert();

Returns the certificate associated with a received encrypted email.

bool GetFileContent(const char * filename, CkByteData & bData);

Reads a file and returns the contents as a String. This is here purely for convenience.

bool GetHeaderField(const char * fieldName, CkString & strFieldData);

Returns the value of a header field.

Returns true for success, false for failure.

bool GetHeaderFieldName(long index, CkString & strFieldName);

Return the name of the Nth header field. The NumHeaderFields() method can be used to get the number of header fields. The GetHeaderField() method can be used to get the value of the field given the field name.

Returns true for success, false for failure.

bool GetHeaderFieldValue(long index, CkString & strFieldValue);

Returns the value of the Nth header field. (Indexing begins at 0) The number of header fields can be obtained from the NumHeaderFields property.

Returns true for success, false for failure.

bool GetHtmlBody(CkString & strBody);

Returns the body having the "text/html" content type.

Returns true for success, false for failure.

int GetImapUid();

(Unreleased) When email headers are downloaded from an IMAP server (using Chilkat IMAP), a "ckx-imap-uid" header field is added. The content of this header is the UID of the email on the IMAP server. This method returns the UID if the header field exists, otherwise it returns -1.

An application that wishes to download the full email would use this UID and then call the Chilkat IMAP object's FetchSingle or FetchSingleAsMime methods.

If this method is not yet available in your version of the Chilkat Email object, you may also call GetHeaderField("ckx-imap-uid") to fetch the UID as a string, and then convert it to an integer.

void GetLinkedDomains(CkStringArray & array);

Parses an HTML email and returns the set of domain names that occur in hyperlinks within the HTML body.

bool GetMbHeaderField(const char * fieldName, CkByteData & fieldData);

Returns a header field's data in a byte array. If the field was Q or B encoded, this is automatically decoded, and the raw bytes of the field are returned. Call GetHeaderField to retrieve the header field as a Unicode string.

bool GetMbHeaderField2(const char * charset, const char * fieldName, CkByteData & fieldData);

Returns the value of a header field converted to a specified charset.

bool GetMbHtmlBody(const char * charset, CkByteData & data);

Returns the HTML body converted to a specified charset. If no HTML body exists, the returned byte array is empty. The returned data will be such that not only is the character data converted (if necessary) to the convertToCharset, but the HTML is edited to add or modify the META tag that specifies the charset within the HTML.

bool GetMbPlainTextBody(const char * charset, CkByteData & data);

Returns the plain-text body converted to a specified charset. The return value is a byte array containing multibyte character data.

void GetMime(CkString & strMime);

Return the email as MIME text containing the email header, body (or bodies), related items (if any), and all attachments

Returns true for success, false for failure.

CkMime * GetMimeObject();

Creates and returns a Mime object containing the contents of the email. This method is provided for those users that need full access to every aspect of the MIME message, such as manipulation of the message headers of attachments and related items contained within message subparts.(The returned Mime object returned is locked, and needs to be unlocked with a Chilkat S/MIME .NET unlock code, which can be obtained by purchasing a Chilkat S/MIME .NET license.)

bool GetPlainTextBody(CkString & strBody);

Returns the email body having the "text/plain" content type.

Returns true for success, false for failure.

bool GetRelatedContentID(long index, CkString & strContentID);

Returns the content ID of a related item contained with the email. Related items are typically images and style-sheets embedded within HTML emails.

Returns true for success, false for failure.

bool GetRelatedContentType(long index, CkString & strContentType);

Returns the content-type of the Nth related content item in an email message.

Returns true for success, false for failure.

bool GetRelatedData(long index, CkByteData & buffer);

Returns the content ID of a related item contained with the email. Related items are typically images and style-sheets embedded within HTML emails.

bool GetRelatedFilename(long index, CkString & strFilename);

Returns the filename of a related item contained with the email. Related items are typically images and style-sheets embedded within HTML emails.

Returns true for success, false for failure.

bool GetRelatedString(long index, const char * charset, CkString & strData);

Returns the text with CR line-endings of a related item contained with the email. Related items are typically images and style-sheets embedded within HTML emails.

Returns true for success, false for failure.

bool GetRelatedStringCrLf(long index, const char * charset, CkString & str);

Returns the text with CRLF line-endings of a related item contained with the email. Related items are typically images and style-sheets embedded within HTML emails.

Returns true for success, false for failure.

bool GetReplacePattern(long index, CkString & strPattern);

Returns a replacement pattern previously defined for mail-merge operations.

Returns true for success, false for failure.

bool GetReplaceString(long index, CkString & str);

Returns a replacement string for a previously defined pattern/replacement string pair. (This is a mail-merge feature.)

Returns true for success, false for failure.

bool GetReplaceString2(const char * pattern, CkString & str);

Returns a replacement string for a previously defined pattern/replacement string pair. (This is a mail-merge feature.)

Returns true for success, false for failure.

CkCert * GetSignedByCert();

Return the certificate used to digitally sign this email.

CkCert * GetSigningCert();

Return the certificate that will be used to digitally sign this email. This is the cerficate that was previously set by calling the SetSigningCert method.

bool GetTo(long index, CkString & str);

Returns a "to" recipient's full email address.

Returns true for success, false for failure.

bool GetToAddr(long index, CkString & str);

Returns the Nth To address (only the address part, not the friendly-name part).

Returns true for success, false for failure.

bool GetToName(long index, CkString & str);

Returns the Nth To name (only the friendly-name part, not the address part).

Returns true for success, false for failure.

void GetXml(CkString & strXml);

Convert the email object to an XML document in memory

Returns true for success, false for failure.

bool HasHeaderMatching(const char * fieldName, const char * valuePattern, bool caseInsensitive);

To be documented soon...

bool HasHtmlBody();

Returns true if the email has an HTML body.

bool HasPlainTextBody();

Returns true if the email has a plain-text body.

bool IsMultipartReport();

Returns true if the email is a multipart/report email.

bool LoadEml(const char * mimeFilename);

Loads a complete email from a .EML file. (EML files are simply RFC822 MIME text files.)

bool LoadXml(const char * xmlFilename);

Loads an email with the contents of an XML email file.

bool LoadXmlString(const char * xmlStr);

Loads an email from an XML string (previously obtained by calling the GetXml method). The contents of the calling email object are erased and replaced with the email contained within the XML string.

Returns true for success, false for failure.

bool QEncodeBytes(const unsigned char * data, unsigned long dataLen, const char * charset, CkString & encodedStr);

Takes a byte array of multibyte (non-Unicode) data and returns a Unicode Q-Encoded string.

Returns true for success, false for failure.

bool QEncodeString(const char * str, const char * charset, CkString & encodedStr);

Takes a Unicode string, converts it to the charset specified in the 2nd parameter, Q-Encodes the converted multibyte data, and returns the encoded Unicode string.

Returns true for success, false for failure.

void RemoveAttachedMessage(long index);

Removes the Nth message/rfc822 sub-part of the email. Indexing begins at 0.

void RemoveAttachedMessages();

Removes all message/rfc822 sub-parts of the email object.

void RemoveAttachmentPaths();

Removes path information from all attachment filenames.

void RemoveHeaderField(const char * fieldName);

Removes by name all occurances of a header field.

bool SaveAllAttachments(const char * directory);

Save all the attachments of an email to a file

Example: Download and Save Email Attachments (POP3)

bool SaveAttachedFile(long index, const char * directory);

Save a specific email attachment to a file

Example: Download and Save Email Attachments (POP3)

bool SaveEml(const char * filename);

Convert this email object to EML and save it to a file.

bool SaveLastError(const char * filename);

Saves the last error information to an XML formatted file.

bool SaveRelatedItem(long index, const char * directory);

Save a related item to a file. Related content items are typically image or style-sheets embedded within an HTML email.

bool SaveXml(const char * filename);

Convert this email object to XML and save it to a file.

bool SetAttachmentCharset(int index, const char * charset);

Sets the charset attribute of the content-type header field for a specified attachment. This can be used if the attachment is a text file that contains text in a non us-ascii charset such as Shift_JIS, iso-8859-2, big5, iso-8859-5, etc.

bool SetAttachmentFilename(long index, const char * filename);

Renames a email attachment's filename. The 1st attachment is at index 0.

bool SetCSP(const CkCSP * csp);

Set the Cryptographic Service Provider (CSP) to be used for encryption or digital signing this email. You do not usually need to call this because the default is usually appropriate. One example of where this might be used is for applications using Smart Cards that need to use the CSP of a Smart Card vendor.

bool SetCSP(const CkCSP & csp);

Set the Cryptographic Service Provider (CSP) to be used for encryption or digital signing this email. You do not usually need to call this because the default is usually appropriate. One example of where this might be used is for applications using Smart Cards that need to use the CSP of a Smart Card vendor.

bool SetEncryptCert(const CkCert * cert);

Set the encryption certificate to be used in encryption. Use the CreateCS, CertStore, and Cert classes to create a Cert object by either locating a certificate in a certificate store or loading one from a file.

Using a .cer Certificate File for Encrypted Email

bool SetEncryptCert(const CkCert & cert);

Set the encryption certificate to be used in encryption. Use the CreateCS, CertStore, and Cert classes to create a Cert object by either locating a certificate in a certificate store or loading one from a file.

Using a .cer Certificate File for Encrypted Email

bool SetFromMimeObject(CkMime & mime);

Loads and replaces the contents of this email object with the contents of a Mime object

bool SetFromMimeText(const char * mimeText);

Replace the contents of this email object with that found in the MIME text

bool SetFromMimeText2(const char * mimeText, int numBytes);

Same as SetFromMimeText, but accepts two arguments: a pointer to the byte data containing the MIME text and a size (in bytes). This is helpful for MIME text that may contain binary data, including NULL bytes.

Returns true for success, false for failure.

bool SetFromXmlText(const char * xmlStr);

Loads an email from an XML string.

void SetHtmlBody(const char * html);

Sets the HTML body of an email.

bool SetMbHtmlBody(const char * charset, const unsigned char * data, unsigned long dataLen);

Sets the HTML email body from a byte array containing character data in the specified character set. This method also updates the email "content-type"header to properly reflect the content type of the body.

bool SetMbPlainTextBody(const char * charset, const unsigned char * data, unsigned long dataLen);

Sets the plain-text email body from a byte array containing character data in the specified character set. This method also updates the email "content-type"header to properly reflect the content type of the body.

bool SetReplacePattern(const char * pattern, const char * replaceString);

Create a pattern/replacement-text pair for mail-merge

bool SetSigningCert(const CkCert * cert);

Set the certificate to be used in creating a digital signature. Use the CreateCS, CertStore, and Cert classes to create a Cert object by either locating a certificate in a certificate store or loading one from a file.

bool SetSigningCert(const CkCert & cert);

Set the certificate to be used in creating a digital signature. Use the CreateCS, CertStore, and Cert classes to create a Cert object by either locating a certificate in a certificate store or loading one from a file.

bool SetSigningCert2(const CkCert & cert, CkPrivateKey & key);

To be documented soon...

void SetTextBody(const char * bodyText, const char * contentType);

To be documented soon...

bool UidlEquals(const CkEmail & e);

True if the caller email has a UIDL that equals the email passed in the argument.

void UnSpamify();

Unobfuscates emails by undoing what spammers do to obfuscate email. It removes comments from HTML bodies and unobfuscates hyperlinked URLs.

bool UnlockComponent(const char * unlockCode);

Added as a convenience so that Chilkat Email.NET can be unlocked without necessarily having to create a MailMan object and calling MailMan.UnlockComponent. Either one of MailMan.UnlockComponent or Email.UnlockComponent can be called once at the beginning of your program to unlock the entire Chilkat Email.NET component.

bool UnpackHtml(const char * unpackDir, const char * htmlFilename, const char * partsSubdir);

Unpacks an HTML email into an HTML file and related files (images and style sheets). The links within the HTML are updated to point to the files unpacked and saved to disk.

Returns true for success, false for failure.

bool UnzipAttachments();

Unzips and replaces any Zip file attachments with the expanded contents. As an example, if an email contained a single Zip file containing 3 GIF image files as an attachment, then after calling this method the email would contain 3 GIF file attachments, and the Zip attachment would be gone.If an email contains multiple Zip file attachments, each Zip is expanded and replaced with the contents.

bool ZipAttachments(const char * zipFilename);

Replaces all the attachments of an email with a single Zip file attachment having the filename specified.

const char * addFileAttachment(const char * fileName);

Adds a file as an attachment to the email. Returns the MIME content-type of the attachment, which is inferred based on the filename extension.

const char * addRelatedFile(const char * fileName);

Adds the contents of a file to the email and returns the Content-ID. Emails formatted in HTML can include images with this call and internally reference the image through a "cid" hyperlink. (Chilkat Email.NET fully supports the MHTML standard.)

const char * addRelatedString(const char * nameInHtml, const char * str, const char * charset);

Adds a related item to the email. A related item is typically an image or style sheet referenced by an HTML tag within the HTML email body. The contents of the related item are passed str. nameInHtml specifies the filename that should be used within the HTML, and not an actual filename on the local filesystem. charset specifies the charset that should be used for the text content of the related item. Returns the content-ID generated for the added item.

const char * bEncodeBytes(const unsigned char * data, unsigned long dataLen, const char * charset);

Takes a byte array of multibyte (non-Unicode) data and returns a Unicode B-Encoded string.

const char * bEncodeString(const char * str, const char * charset);

Takes a Unicode string, converts it to the charset specified in the 2nd parameter, B-Encodes the converted multibyte data, and returns the encoded Unicode string.

const char * body();

The body of the email. If the email has both HTML and plain-text bodies, this property returns the HTML body. The GetHtmlBody and GetPlainTextBody methods can be used to access a specific body. The HasHtmlBody and HasPlainTextBody methods can be used to determine the presence of a body.

const char * bounceAddress();

The "return-path" address of the email. Bounces will go to this address.

const char * charset();

Sets the charset for the entire email. The header fields and plain-text/HTML bodies will be converted and sent in this charset. (This includes parsing and updating the HTML with the appropriate META tag specifying the charset.) All formatting and encoding of the email MIME is handled automatically by the Chilkat Mail component. If your application wants to send a Shift_JIS email, you simply set the Charset property to "Shift_JIS". Note: If a charset property is not explicitly set, the Chilkat component automatically detects the charset and chooses the appropriate charset. If all characters are 7bit (i.e. us-ascii) the charset is left blank. If the email contain a mix of languages such that no one charset can be chosen, or if the language cannot be determined without ambiguity, then the "utf-8" charset will be chosen.

const char * ck_from();

To be documented soon...

const char * createTempMht(const char * inFilename);

Saves the email to a temporary MHT file so that a WebBrowser control can navigate to it and display it. If fileName is empty, a temporary filename is generated and returned. If fileName is non-empty, then it will be created or overwritten, and the input filename is simply returned.The MHT file that is created will not contain any of the email's attachments, if any existed. Also, if the email was plain-text, the MHT file will be saved such that the plain-text is converted to HTML using pre-formatted text ("pre" HTML tags) allowing it to be displayed correctly in a WebBrowser.

const char * encryptedBy();

If the email was received encrypted, this contains the details of the certificate used for encryption.

const char * fileDistList();

Set this property to send an email to a list of recipients stored in a plain text file. The file format is simple: one recipient per line, no comments allowed, blank lines are ignored.Setting this property is equivalent to adding a "CKX-FileDistList"header field to the email. Chilkat Mail treats header fields beginning with "CKX-"specially in that these fields are never transmitted with the email when sent. However, CKX fields are saved and restored when saving to XML or loading from XML (or MIME). When sending an email containing a "CKX-FileDistList"header field, Chilkat Mail will read the distribution list file and send the email to each recipient. Emails can be sent individually, or with BCC, 100 recipients at a time. (see the MailMan.SendIndividual property).

const char * fromAddress();

The email address of the sender.

const char * fromName();

The name of the sender.

const char * generateFilename();

Generates a unique filename for this email. The filename will be different each time the method is called.

const char * getAltHeaderField(int index, const char * fieldName);

Returns the value of a header field within the Nth alternative body's MIME sub-part.

const char * getAlternativeBody(long index);

Returns the Nth alternative body. The NumAlternatives property tells the number of alternative bodies present. Use the GetHtmlBody and GetPlainTextBody methods to easily get the HTML or plain text alternative bodies.

const char * getAlternativeContentType(long index);

Returns the content type of the Nth alternative body. The NumAlternatives property tells the number of alternative bodies present.

const char * getAttachedMessageFilename(int index);

Returns the filename of the Nth attached (embedded) email. The filename is the "filename" attribute of the content-disposition header field found within the Nth message/rfc822 sub-part of the calling email object.

const char * getAttachmentContentID(long index);

Returns the ContentID header field for the Nth attachment. The first attachment is at index 0.

const char * getAttachmentContentType(long index);

Returns the Content-Type header field for the Nth attachment. Indexing of attachments begins at 0.

const char * getAttachmentFilename(long index);

Retrieves an attachment's filename.

const char * getAttachmentHeader(long index, const char * fieldName);

Returns the value of a header field (by name) of an attachment.

const char * getAttachmentString(long index, const char * charset);

Retrieves an attachment's data as a String. All CRLF sequences will be translated to single newline characters.

const char * getAttachmentStringCrLf(long index, const char * charset);

Retrieves an attachment's data as a String. All end-of-lines will be translated to CRLF sequences.

const char * getBcc(long index);

Returns a blind carbon-copy recipient's full email address.

const char * getBccAddr(long index);

Returns the Nth BCC address (only the address part, not the friendly-name part).

const char * getBccName(long index);

Returns the Nth BCC name (only the friendly-name part, not the address part).

const char * getCC(long index);

Returns a carbon-copy recipient's full email address.

const char * getCcAddr(long index);

Returns the Nth CC address (only the address part, not the friendly-name part).

const char * getCcName(long index);

Returns the Nth CC name (only the friendly-name part, not the address part).

const char * getDeliveryStatusInfo(const char * fieldName);

If the email is a multipart/report, then it is a delivery status notification. This method can be used to get individual pieces of information from the message/delivery-status part of the email. This method should only be called if the IsMultipartReport method returns true.

The fieldName should be set a string such as "Final-Recipient", "Status", "Action", "Reporting-MTA", etc.

Reporting-MTA: dns; XYZ.abc.nl

Final-recipient: RFC822; someEmailAddr@doesnotexist123.nl
Action: failed
Status: 5.4.4
X-Supplementary-Info: < #5.4.4 smtp;554 5.4.4
 SMTPSEND.DNS.NonExistentDomain; nonexistent domain>

const char * getHeaderField(const char * fieldName);

Returns the value of a header field.

const char * getHeaderFieldName(long index);

Return the name of the Nth header field. The NumHeaderFields() method can be used to get the number of header fields. The GetHeaderField() method can be used to get the value of the field given the field name.

const char * getHeaderFieldValue(long index);

Returns the value of the Nth header field. (Indexing begins at 0) The number of header fields can be obtained from the NumHeaderFields property.

const char * getHtmlBody();

Returns the body having the "text/html" content type.

const char * getMime();

Return the email as MIME text containing the email header, body (or bodies), related items (if any), and all attachments

const char * getPlainTextBody();

Returns the email body having the "text/plain" content type.

const char * getRelatedContentID(long index);

Returns the content ID of a related item contained with the email. Related items are typically images and style-sheets embedded within HTML emails.

const char * getRelatedContentType(long index);

Returns the content-type of the Nth related content item in an email message.

const char * getRelatedFilename(long index);

Returns the filename of a related item contained with the email. Related items are typically images and style-sheets embedded within HTML emails.

const char * getRelatedString(long index, const char * charset);

Returns the text with CR line-endings of a related item contained with the email. Related items are typically images and style-sheets embedded within HTML emails.

const char * getRelatedStringCrLf(long index, const char * charset);

Returns the text with CRLF line-endings of a related item contained with the email. Related items are typically images and style-sheets embedded within HTML emails.

const char * getReplacePattern(long index);

Returns a replacement pattern previously defined for mail-merge operations.

const char * getReplaceString(long index);

Returns a replacement string for a previously defined pattern/replacement string pair. (This is a mail-merge feature.)

const char * getReplaceString2(const char * pattern);

Returns a replacement string for a previously defined pattern/replacement string pair. (This is a mail-merge feature.)

const char * getTo(long index);

Returns a "to" recipient's full email address.

const char * getToAddr(long index);

Returns the Nth To address (only the address part, not the friendly-name part).

const char * getToName(long index);

Returns the Nth To name (only the friendly-name part, not the address part).

const char * getXml();

Convert the email object to an XML document in memory

const char * header();

The complete MIME header of the email.

const char * language();

(PreRelease) A read-only property that identifies the primary language group for the email. Possible values are:

  • "latin1" (for English and all Western European languages)
  • "central" (for Central European languages such as Polish, Czech, Hungarian, etc.)
  • "russian" (for Cyrillic languages)
  • "greek"
  • "turkish"
  • "hebrew"
  • "arabic"
  • "baltic"
  • "thai"
  • "vietnamese"
  • "chinese"
  • "japanese"
  • "korean"
  • "unknown"
The language group determination is made soley on the subject and plain-text/HTML email bodies. Characters in the FROM, TO, CC, and other header fields are not considered.

The primary determining factor is the characters found in the Subject header field. For example, if an email contains Japanese in the Subject, but the body contains Russian characters, it will be considered "japanese".

const char * lastErrorHtml();

Error information in HTML format for the last method called.

const char * lastErrorText();

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

const char * lastErrorXml();

Error information in XML format for the last method called.

const char * mailer();

Identifies the email software that sent the email.

const char * qEncodeBytes(const unsigned char * data, unsigned long dataLen, const char * charset);

Takes a byte array of multibyte (non-Unicode) data and returns a Unicode Q-Encoded string.

const char * qEncodeString(const char * str, const char * charset);

Takes a Unicode string, converts it to the charset specified in the 2nd parameter, Q-Encodes the converted multibyte data, and returns the encoded Unicode string.

const char * replyTo();

The email address to be used when a recipient replies.

const char * signedBy();

If the email was received digitally signed, this property contains the details of the signer.

const char * subject();

The email subject.

const char * uidl();

This is the unique ID assigned by the POP3 server. Emails can be retrieved or deleted from the POP3 server via the UIDL. The header field for this property is "X-UIDL".