Chilkat VB.NET Email Class Reference

Email

Represents a complete Email object.

Object Creation

(C#)
Chilkat.Email obj = new Chilkat.Email();
(VB.NET)
Dim obj As New Chilkat.Email()

Properties

Body As String

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.

BounceAddress As String

The "return-path" address of the email. Bounces (i.e. delivery status notifications, or DSN's) will go to this address.

Charset As String

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.

Decrypted As Boolean (ReadOnly)

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

EmailDate As Date

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

EncryptedBy As String (ReadOnly)

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

FileDistList As String

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).

From As String

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

FromAddress As String

The email address of the sender.

FromName As String

The name of the sender.

Header As String (ReadOnly)

The complete MIME header of the email.

Language As String (ReadOnly)

(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".

LastErrorHtml As String (ReadOnly)

Error information in HTML format for the last method called.

LastErrorText As String (ReadOnly)

To be documented soon.Error information in plain-text format for the last method called.

LastErrorXml As String (ReadOnly)

Error information in XML format for the last method called.

LocalDate As Date

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

Mailer As String

Identifies the email software that sent the email.

NumAlternatives As Integer (ReadOnly)

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.

NumAttachedMessages As Integer (ReadOnly)

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

NumAttachments As Integer (ReadOnly)

The number of attachments contained in the email.

NumBcc As Integer (ReadOnly)

The number of blind carbon-copy email recipients.

NumCC As Integer (ReadOnly)

The number of carbon-copy email recipients.

NumDaysOld As Integer (ReadOnly)

Returns the number of days old from the current system date/time. The email's date is obtained from the "Date" header field. If the Date header field is missing, or invalid, then -9999 is returned. A negative number may be returned if the Date header field contains a future date/time. (However, -9999 represents an error condition.)

NumHeaderFields As Integer (ReadOnly)

The number of header fields.

NumRelatedItems As Integer (ReadOnly)

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.

NumReplacePatterns As Integer (ReadOnly)

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.

NumTo As Integer (ReadOnly)

The number of direct email recipients.

OverwriteExisting As Boolean

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.

PreferredCharset As String

Only applies when building an email with non-English characters where the charset is not explicitly set. The Chilkat email component will automatically choose a charset based on the languages found within an email (if the charset is not already specified within the MIME or explicitly specified by setting the Charset property). The default charset chosen for each language is:

Chinese: gb2312
Japanese: shift_JIS
Korean: ks_c_5601-1987
Thai: windows-874
All others: iso-8859-*

This allows for charsets such as iso-2022-jp to be chosen instead of the default. If the preferred charset does not apply to the situation, it is not used. For example, if the preferred charset is iso-2022-jp, but the email contains Greek characters, then the preferred charset is ignored.

ReceivedEncrypted As Boolean (ReadOnly)

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

ReceivedSigned As Boolean (ReadOnly)

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

ReplyTo As String

The email address to be used when a recipient replies.

ReturnReceipt As Boolean

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

SendEncrypted As Boolean

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

SendSigned As Boolean

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

SignaturesValid As Boolean (ReadOnly)

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.

SignedBy As String (ReadOnly)

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

Size As Integer (ReadOnly)

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

Subject As String

The email subject.

Uidl As String (ReadOnly)

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".

VerboseLogging As Boolean

To be documented soon...

Methods

Sub AddAttachmentHeader(ByVal index As Integer, ByVal fieldName As String, ByVal fieldValue As String)

Adds a MIME header field to one of the attachments.

Function AddBcc(ByVal friendlyName As String, ByVal emailAddress As String) As Boolean

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.

Function AddCC(ByVal friendlyName As String, ByVal emailAddress As String) As Boolean

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

Function AddDataAttachment(ByVal fileName As String, ByVal content As Byte()) As Boolean

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

Function AddDataAttachment2(ByVal fileName As String, ByVal content As Byte(), ByVal contentType As String) As Boolean

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

Function AddEncryptCert(ByVal cert As Cert) As Boolean

Allows for certificates to be explicitly specified for sending encrypted email to one or more recipients. Call this method once per certificate to be used. The ClearEncryptCerts method may be called to clear the list of explicitly-specified certificates.

Note: It is possible to send encrypted email without explicitly specifying the certificates. The Chilkat email component will automatically search the registry-based Current-User and Local-Machine certificate stores for certs matching each of the recipients (To, CC, and BCC recipients).

Note: The SentEncryptCert method is equivalent to calling ClearEncryptCerts followed by AddEncryptCert.

Returns true for success, false for failure.

Function AddFileAttachment(ByVal fileName As String) As String

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

Function AddFileAttachment2(ByVal fileName As String, ByVal contentType As String) As Boolean

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

Sub AddHeaderField(ByVal fieldName As String, ByVal fieldValue As String)

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.

Function AddHtmlAlternativeBody(ByVal body As String) As Boolean

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.

Function AddMultipleBcc(ByVal commaSeparatedAddresses As String) As Boolean

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.

Function AddMultipleCC(ByVal commaSeparatedAddresses As String) As Boolean

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.

Function AddMultipleTo(ByVal commaSeparatedAddresses As String) As Boolean

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.

Function AddPlainTextAlternativeBody(ByVal body As String) As Boolean

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.

Function AddRelatedData(ByVal fileName As String, ByVal inData As Byte()) As String

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

Sub AddRelatedData2(ByVal inData As Byte(), ByVal fileNameInHtml As String)

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.

Function AddRelatedFile(ByVal fileName As String) As String

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

Function AddRelatedFile2(ByVal filenameOnDisk As String, ByVal filenameInHtml As String) As Boolean

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.

Sub AddRelatedHeader(ByVal index As Integer, ByVal fieldName As String, ByVal fieldValue As String)

To be documented soon...

Function AddRelatedString(ByVal nameInHtml As String, ByVal str As String, ByVal charset As String) As String

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

Sub AddRelatedString2(ByVal content As String, ByVal charset As String, ByVal fileNameInHtml As String)

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.

Function AddStringAttachment(ByVal fileName As String, ByVal content As String) As Boolean

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

Function AddStringAttachment2(ByVal fileName As String, ByVal content As String, ByVal charset As String) As Boolean

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.

Function AddTo(ByVal friendlyName As String, ByVal emailAddress As String) As Boolean

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 .

Function AesDecrypt(ByVal password As String) As Boolean

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

Function AesEncrypt(ByVal password As String) As Boolean

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.

Sub AppendToBody(ByVal str As String)

Appends a string to the plain-text body.

Function AspUnpack(ByVal prefix As String, ByVal saveDir As String, ByVal urlPath As String, ByVal cleanFiles As Boolean) As Boolean

Please see the examples at the following pages for detailed information:

Returns true for success, false for failure.

Display HTML Email in Web Page

Display HTML Email in IFrame (or Frame)

Function AspUnpack2(ByVal prefix As String, ByVal saveDir As String, ByVal urlPath As String, ByVal cleanFiles As Boolean) As Byte()

Please see the examples at the following pages for detailed information:

Returns Nothing on failure

Display HTML Email in Web Page

Display HTML Email in IFrame (or Frame)

Function AttachMessage(ByVal mimeBytes As Byte()) As Boolean

Attaches a MIME message to the email object. The attached MIME will be encapsulated in an message/rfc822 sub-part. To attach one email object to another, pass the output of GetMimeBinary to the input of this method.

Returns true for success, false for failure.

Function BEncodeBytes(ByVal inData As Byte(), ByVal charset As String) As String

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

Returns Nothing on failure

Function BEncodeString(ByVal str As String, ByVal charset As String) As String

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

Sub ClearBcc()

Clears the list of blind carbon-copy recipients.

Sub ClearCC()

Clears the list of carbon-copy recipients.

Sub ClearEncryptCerts()

Clears the internal list of explicitly specified certificates to be used for this encrypted email.

Sub ClearTo()

Clears the list of "to" recipients.

Function Clone() As Email

Creates and returns an identical copy of the Email object.

Returns Nothing on failure

Function ComputeGlobalKey(ByVal encoding As String, ByVal bFold As Boolean) As String

Computes a global unique key for the email that may be used as a key for a relational database table (or anything else). The key is created by a digest-MD5 hash of the concatenation of the following header fields: Message-ID, Subject, From, Date, To. (The header fields are Q/B decoded if necessary, converted to the utf-8 encoding, concatenated, and hashed using MD5.) The 16-byte MD5 hash is returned as an encoded string. The encoding determines the encoding: base64, hex, url, etc. If bFold is true, then the 16-byte MD5 hash is folded to 8 bytes with an XOR to produce a shorter key.

Returns Nothing on failure

Function CreateForward() As Email

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

Function CreateReply() As Email

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

Function CreateTempMht(ByVal inFilename As String) As String

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

Function Decompose() As Mime

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.)

Sub DropAttachments()

Removes all attachments from the email.

Sub DropRelatedItem(ByVal index As Integer)

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.

Sub 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.

Function DropSingleAttachment(ByVal index As Integer) As Boolean

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

Function GenerateFilename() As String

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

Returns Nothing on failure

Function GetAltHeaderField(ByVal index As Integer, ByVal fieldName As String) As String

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

Returns Nothing on failure

Function GetAlternativeBody(ByVal index As Integer) As String

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

Function GetAlternativeContentType(ByVal index As Integer) As String

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

Returns Nothing on failure

Function GetAttachedMessage(ByVal index As Integer) As Email

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

Function GetAttachedMessageFilename(ByVal index As Integer) As String

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

Function GetAttachmentContentID(ByVal index As Integer) As String

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

Returns Nothing on failure

Function GetAttachmentContentType(ByVal index As Integer) As String

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

Returns Nothing on failure

Function GetAttachmentData(ByVal index As Integer) As Byte()

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

Returns Nothing on failure

Function GetAttachmentFilename(ByVal index As Integer) As String

Retrieves an attachment's filename.

Returns Nothing on failure

Function GetAttachmentHeader(ByVal attachIndex As Integer, ByVal fieldName As String) As String

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

Returns Nothing on failure

Function GetAttachmentSize(ByVal index As Integer) As Integer

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

Function GetAttachmentString(ByVal index As Integer, ByVal charset As String) As String

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

Returns Nothing on failure

Function GetAttachmentStringCrLf(ByVal index As Integer, ByVal charset As String) As String

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

Returns Nothing on failure

Function GetBcc(ByVal index As Integer) As String

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

Returns Nothing on failure

Function GetBccAddr(ByVal index As Integer) As String

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

Returns Nothing on failure

Function GetBccName(ByVal index As Integer) As String

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

Returns Nothing on failure

Function GetCC(ByVal index As Integer) As String

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

Returns Nothing on failure

Function GetCcAddr(ByVal index As Integer) As String

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

Returns Nothing on failure

Function GetCcName(ByVal index As Integer) As String

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

Returns Nothing on failure

Function GetDeliveryStatusInfo(ByVal fieldName As String) As String

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

Function GetDsnFinalRecipients() As StringArray

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

Returns Nothing on failure

Function GetEncryptCert() As Cert

Returns the certificate that was previously set by SetEncryptCert.

Function GetEncryptedByCert() As Cert

Returns the certificate associated with a received encrypted email.

Function GetFileContent(ByVal filename As String) As Byte()

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

Returns Nothing on failure

Function GetHeaderField(ByVal fieldName As String) As String

Returns the value of a header field.

Returns Nothing on failure

Function GetHeaderFieldName(ByVal index As Integer) As String

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

Function GetHeaderFieldValue(ByVal index As Integer) As String

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

Function GetHtmlBody() As String

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

Returns Nothing on failure

Function GetImapUid() As Integer

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 or sequence number of the email on the IMAP server. In addition, a "ckx-imap-isUid" header field is added, and this will have the value YES or NO. If the value is YES, then ckx-imap-uid contains a UID, if the value is NO, then ckx-imap-uid contains the sequence number. This method returns the UID if ckx-imap-uid exists and contains a UID, 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.

Function GetLinkedDomains() As StringArray

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

Returns Nothing on failure

Function GetMbHeaderField(ByVal fieldName As String, ByVal charset As String) As Byte()

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.

Returns Nothing on failure

Function GetMbHtmlBody(ByVal charset As String) As Byte()

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.

Returns Nothing on failure

Function GetMbPlainTextBody(ByVal charset As String) As Byte()

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

Returns Nothing on failure

Function GetMime() As String

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

Returns Nothing on failure

Function GetMimeBinary() As Byte()

Returns the full MIME of an email.

Returns Nothing on failure

Function GetMimeObject() As Mime

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.)

Function GetPlainTextBody() As String

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

Returns Nothing on failure

Function GetRelatedContentID(ByVal index As Integer) As String

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

Function GetRelatedContentLocation(ByVal index As Integer) As String

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

Returns Nothing on failure

Function GetRelatedContentType(ByVal index As Integer) As String

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

Returns Nothing on failure

Function GetRelatedData(ByVal index As Integer) As Byte()

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

Function GetRelatedFilename(ByVal index As Integer) As String

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

Returns Nothing on failure

Function GetRelatedString(ByVal index As Integer, ByVal charset As String) As String

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

Function GetRelatedStringCrLf(ByVal index As Integer, ByVal charset As String) As String

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

Function GetReplacePattern(ByVal index As Integer) As String

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

Returns Nothing on failure

Function GetReplaceString(ByVal index As Integer) As String

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

Returns Nothing on failure

Function GetReplaceString2(ByVal pattern As String) As String

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

Returns Nothing on failure

Function GetSignedByCert() As Cert

Return the certificate used to digitally sign this email.

Function GetSigningCert() As Cert

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.

Function GetTo(ByVal index As Integer) As String

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

Returns Nothing on failure

Function GetToAddr(ByVal index As Integer) As String

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

Returns Nothing on failure

Function GetToName(ByVal index As Integer) As String

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

Returns Nothing on failure

Function GetXml() As String

Convert the email object to an XML document in memory

Returns Nothing on failure

Function HasHeaderMatching(ByVal fieldName As String, ByVal valuePattern As String, ByVal caseSensitive As Boolean) As Boolean

Returns true if the email has a header field with the specified fieldName with a value matching valuePattern. Case sensitivity is controlled by caseSensitive. The valuePattern may include 0 or more asterisk (wildcard) characters which match 0 or more of any character.

Function HasHtmlBody() As Boolean

Returns true if the email has an HTML body.

Function HasPlainTextBody() As Boolean

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

Function IsMultipartReport() As Boolean

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

Function LoadEml(ByVal mimeFilename As String) As Boolean

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

Function LoadXml(ByVal xmlFilename As String) As Boolean

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

Function LoadXmlString(ByVal xmlStr As String) As Boolean

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.

Function QEncodeBytes(ByVal inData As Byte(), ByVal charset As String) As String

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

Returns Nothing on failure

Function QEncodeString(ByVal str As String, ByVal charset As String) As String

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

Sub RemoveAttachedMessage(ByVal idx As Integer)

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

Sub RemoveAttachedMessages()

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

Sub RemoveAttachmentPaths()

Removes path information from all attachment filenames.

Sub RemoveHeaderField(ByVal fieldName As String)

Removes by name all occurances of a header field.

Function SaveAllAttachments(ByVal directory As String) As Boolean

Save all the attachments of an email to a file

Example: Download and Save Email Attachments (POP3)

Function SaveAttachedFile(ByVal index As Integer, ByVal directory As String) As Boolean

Save a specific email attachment to a file

Example: Download and Save Email Attachments (POP3)

Function SaveEml(ByVal filename As String) As Boolean

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

Function SaveLastError(ByVal filename As String) As Boolean

Saves the last error information to an XML formatted file.

Function SaveRelatedItem(ByVal index As Integer, ByVal directory As String) As Boolean

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

Function SaveXml(ByVal filename As String) As Boolean

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

Function SetAttachmentCharset(ByVal index As Integer, ByVal charset As String) As Boolean

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.

Returns true for success, false for failure.

Function SetAttachmentDisposition(ByVal index As Integer, ByVal disposition As String) As Boolean

Set's an attachment's disposition. The default disposition of an attachment is "attachment". This method is typically called to change the disposition to "inline". The 1st attachment is at ARG1 0.

Returns true for success, false for failure.

Function SetAttachmentFilename(ByVal index As Integer, ByVal filename As String) As Boolean

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

Returns true for success, false for failure.

Function SetCSP(ByVal csp As Csp) As Boolean

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.

Function SetEncryptCert(ByVal cert As Cert) As Boolean

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

Function SetFromMimeBytes(ByVal mimeBytes As Byte()) As Boolean

To be documented soon.

Returns true for success, false for failure.

Function SetFromMimeObject(ByVal mime As Mime) As Boolean

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

Function SetFromMimeText(ByVal mimeText As String) As Boolean

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

Function SetFromXmlText(ByVal xmlStr As String) As Boolean

Loads an email from an XML string.

Sub SetHtmlBody(ByVal html As String)

Sets the HTML body of an email.

Sub SetMbHtmlBody(ByVal charset As String, ByVal inData As Byte())

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.

Sub SetMbPlainTextBody(ByVal charset As String, ByVal inData As Byte())

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.

Function SetReplacePattern(ByVal pattern As String, ByVal replaceString As String) As Boolean

Create a pattern/replacement-text pair for mail-merge. When the email is sent via the MailMan's SendEmail method, or any other mail-sending method, the patterns are replaced with the replacement strings during the sending process. Do define multiple replacement patterns, simply call SetReplacePattern once per pattern/replacement string. (Note: The MailMan's RenderToMime method will also do pattern replacements. Methods such as SaveEml or GetMime do not replace patterns.)

Note: Replacement patterns may be placed in any header field, and in both HTML and plain-text email bodies.

Function SetSigningCert(ByVal cert As Cert) As Boolean

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.

Returns true for success, false for failure.

Function SetSigningCert2(ByVal cert As Cert, ByVal key As PrivateKey) As Boolean

Explicitly sets the certificate and private key to be used for sending digitally signed email. If the certificate's private key is already installed on the computer, then one may simply call SetSigningCert because the Chilkat component will automatically locate and use the corresponding private key (stored in the Windows Protected Store). In most cases, if the digital certificate is already installed w/ private key on the computer, it is not necessary to explicitly set the signing certificate at all. The Chilkat component will automatically locate and use the certificate containing the FROM email address (from the registry-based certificate store where it was installed).

Returns true for success, false for failure.

Sub SetTextBody(ByVal bodyText As String, ByVal contentType As String)

Sets the body of the email and also sets the Content-Type header field of the contentType. If the email is already multipart/alternative, an additional alternative with the indicated Content-Type will be added. If an alternative with the same Content-Type already exists, it is replaced.

Function UidlEquals(ByVal e As Email) As Boolean

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

Sub UnSpamify()

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

Function UnpackHtml(ByVal unpackDir As String, ByVal htmlFilename As String, ByVal partsSubdir As String) As Boolean

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.

Function UnwrapSecurity() As Boolean

To be documented soon...

Function UnzipAttachments() As Boolean

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.

Function ZipAttachments(ByVal zipFilename As String) As Boolean

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