Email Tcl Reference Documentation

Email

Current Version: 10.0.0

Represents a complete Email object.

Object Creation

set myEmail [new CkEmail]

Properties

Body
string
# ckStr is a CkString
CkEmail_get_Body $myEmail $ckStr
set strVal [CkEmail_get_body $myEmail]
CkEmail_put_Body $myEmail $strVal

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.

More Information and Examples
top
BounceAddress
string
# ckStr is a CkString
CkEmail_get_BounceAddress $myEmail $ckStr
set strVal [CkEmail_get_bounceAddress $myEmail]
CkEmail_put_BounceAddress $myEmail $strVal

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

Note: This is not the content of the "return-path" header for emails that are downloaded from a POP3 or IMAP server. The BounceAddress is the email address to be used in the process of sending the email via SMTP. (See the "SMTP Protocol in a Nutshell" link below.) The BounceAddress is the email address passed in the "MAIL FROM" SMTP command which becomes the "return-path" header in the email when received.

Note: The Sender and BounceAddress properties are identical and perform the same function. Setting the Sender property also sets the BounceAddress property, and vice-versa. The reason for the duplication is that BounceAddress existed first, and developers typically searched for a "Sender" property without realizing that the BounceAddress property served this function.

top
Charset
string
# ckStr is a CkString
CkEmail_get_Charset $myEmail $ckStr
set strVal [CkEmail_get_charset $myEmail]
CkEmail_put_Charset $myEmail $strVal

Represents the main charset of the email, such as "utf-8", "iso-8859-1", "Shift_JIS", "us-ascii", etc. This property can be empty if there is no explicit charset, such as for emails with only us-ascii.

Setting this property causes Chilkat to use the new charset in HTML and plain-text bodies, where possible. This can include updating the HTML META tag in HTML bodies to agree with the charset specified in the email header and also the byte representation of the HTML body in the email.

More Information and Examples
top
DebugLogFilePath
string
# ckStr is a CkString
CkEmail_get_DebugLogFilePath $myEmail $ckStr
set strVal [CkEmail_get_debugLogFilePath $myEmail]
CkEmail_put_DebugLogFilePath $myEmail $strVal

If set to a file path, causes each Chilkat method or property call to automatically append it's LastErrorText to the specified log file. The information is appended such that if a hang or crash occurs, it is possible to see the context in which the problem occurred, as well as a history of all Chilkat calls up to the point of the problem. The VerboseLogging property can be set to provide more detailed information.

This property is typically used for debugging the rare cases where a Chilkat method call hangs or generates an exception that halts program execution (i.e. crashes). A hang or crash should generally never happen. The typical causes of a hang are:

  1. a timeout related property was set to 0 to explicitly indicate that an infinite timeout is desired,
  2. the hang is actually a hang within an event callback (i.e. it is a hang within the application code), or
  3. there is an internal problem (bug) in the Chilkat code that causes the hang.

More Information and Examples
top
Decrypted
boolean 1/0
set boolVal [CkEmail_get_Decrypted $myEmail]

1 if the email arrived encrypted and was successfully decrypted, otherwise 0. This property is only meaningful when the ReceivedEncrypted property is equal to 1.

top
EmailDateStr
string
# ckStr is a CkString
CkEmail_get_EmailDateStr $myEmail $ckStr
set strVal [CkEmail_get_emailDateStr $myEmail]
CkEmail_put_EmailDateStr $myEmail $strVal

The date/time from the "Date" header in the UTC/GMT timezone in RFC822 string form.

top
EncryptedBy
string
# ckStr is a CkString
CkEmail_get_EncryptedBy $myEmail $ckStr
set strVal [CkEmail_get_encryptedBy $myEmail]

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

top
FileDistList
string
# ckStr is a CkString
CkEmail_get_FileDistList $myEmail $ckStr
set strVal [CkEmail_get_fileDistList $myEmail]
CkEmail_put_FileDistList $myEmail $strVal

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

top
From
string
# ckStr is a CkString
CkEmail_get_From $myEmail $ckStr
set strVal [CkEmail_get_ck_from $myEmail]
CkEmail_put_From $myEmail $strVal

The combined name and email address of the sender, such as "John Smith" . This is the content that will be placed in the From: header field. If the actual sender is to be different, then set the Sender property to a different email address.

top
FromAddress
string
# ckStr is a CkString
CkEmail_get_FromAddress $myEmail $ckStr
set strVal [CkEmail_get_fromAddress $myEmail]
CkEmail_put_FromAddress $myEmail $strVal

The email address of the sender.

top
FromName
string
# ckStr is a CkString
CkEmail_get_FromName $myEmail $ckStr
set strVal [CkEmail_get_fromName $myEmail]
CkEmail_put_FromName $myEmail $strVal

The name of the sender.

top
Header
string
# ckStr is a CkString
CkEmail_get_Header $myEmail $ckStr
set strVal [CkEmail_get_header $myEmail]

The complete MIME header of the email.

top
Language
string
# ckStr is a CkString
CkEmail_get_Language $myEmail $ckStr
set strVal [CkEmail_get_language $myEmail]

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"
  • "thai"
  • "vietnamese"
  • "chinese"
  • "japanese"
  • "korean"
  • "devanagari"
  • "bengali"
  • "gurmukhi"
  • "gujarati"
  • "oriya"
  • "tamil"
  • "telugu"
  • "kannada"
  • "malayalam"
  • "sinhala"
  • "lao"
  • "tibetan"
  • "myanmar"
  • "georgian"
  • "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".

The language is determined by where the Unicode chars fall in various blocks in the Unicode Basic Multilingual Plane. For more information, see the book "Unicode Demystified" by Richard Gillam.

top
LastErrorHtml
string
# ckStr is a CkString
CkEmail_get_LastErrorHtml $myEmail $ckStr
set strVal [CkEmail_get_lastErrorHtml $myEmail]

Provides information in HTML format about the last method/property called. If a method call returns a value indicating failure, or behaves unexpectedly, examine this property to get more information.

top
LastErrorText
string
# ckStr is a CkString
CkEmail_get_LastErrorText $myEmail $ckStr
set strVal [CkEmail_get_lastErrorText $myEmail]

Provides information in plain-text format about the last method/property called. If a method call returns a value indicating failure, or behaves unexpectedly, examine this property to get more information.

top
LastErrorXml
string
# ckStr is a CkString
CkEmail_get_LastErrorXml $myEmail $ckStr
set strVal [CkEmail_get_lastErrorXml $myEmail]

Provides information in XML format about the last method/property called. If a method call returns a value indicating failure, or behaves unexpectedly, examine this property to get more information.

top
LastMethodSuccess
boolean 1/0
set boolVal [CkEmail_get_LastMethodSuccess $myEmail]
CkEmail_put_LastMethodSuccess $myEmail $boolVal

Indicate whether the last method call succeeded or failed. A value of 1 indicates success, a value of 0 indicates failure. This property is automatically set for method calls. It is not modified by property accesses. The property is automatically set to indicate success for the following types of method calls:

  • Any method that returns a string.
  • Any method returning a Chilkat object, binary bytes, or a date/time.
  • Any method returning a standard boolean status value where success = 1 and failure = 0.
  • Any method returning an integer where failure is defined by a return value less than zero.

Note: Methods that do not fit the above requirements will always set this property equal to 1. For example, a method that returns no value (such as a "void" in C++) will technically always succeed.

top
LocalDateStr
string
# ckStr is a CkString
CkEmail_get_LocalDateStr $myEmail $ckStr
set strVal [CkEmail_get_localDateStr $myEmail]
CkEmail_put_LocalDateStr $myEmail $strVal

The date/time found in the "Date" header field returned in the local timezone in RFC822 string form.

top
Mailer
string
# ckStr is a CkString
CkEmail_get_Mailer $myEmail $ckStr
set strVal [CkEmail_get_mailer $myEmail]
CkEmail_put_Mailer $myEmail $strVal

Identifies the email software that sent the email.

top
NumAlternatives
integer
set intVal [CkEmail_get_NumAlternatives $myEmail]

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.

top
NumAttachedMessages
integer
set intVal [CkEmail_get_NumAttachedMessages $myEmail]

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.

top
NumAttachments
integer
set intVal [CkEmail_get_NumAttachments $myEmail]

The number of attachments contained in the email.

Note: If an email is downloaded from an IMAP server without attachments, then the number of attachments should be obtained by calling the IMAP object's GetMailNumAttach method. This property indicates the actual number of attachments already present within the email object.

top
NumBcc
integer
set intVal [CkEmail_get_NumBcc $myEmail]

The number of blind carbon-copy email recipients.

top
NumCC
integer
set intVal [CkEmail_get_NumCC $myEmail]

The number of carbon-copy email recipients.

More Information and Examples
top
NumDaysOld
integer
set intVal [CkEmail_get_NumDaysOld $myEmail]

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

top
NumDigests
integer
set intVal [CkEmail_get_NumDigests $myEmail]
Introduced in version 9.5.0.66

Returns the number of message/rfc822 parts contained within the multipart/digest enclosure. If no multipart/digest enclosure exists, then this property has the value of 0. The GetDigest method is called to get the Nth digest as an email object.

More Information and Examples
top
NumHeaderFields
integer
set intVal [CkEmail_get_NumHeaderFields $myEmail]

The number of header fields. When accessing a header field by index, the 1st header field is at index 0, and the last is at NumHeaderFields-1. (Chilkat indexing is always 0-based.)

top
NumRelatedItems
integer
set intVal [CkEmail_get_NumRelatedItems $myEmail]

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.

top
NumReplacePatterns
integer
set intVal [CkEmail_get_NumReplacePatterns $myEmail]

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.

More Information and Examples
top
NumReports
integer
set intVal [CkEmail_get_NumReports $myEmail]

(For multipart/report emails that have sub-parts with Content-Types such as message/feedback-report.) Any MIME sub-part within the email that has a Content-Type of "message/*", but is not a "message/rfc822", is considered to be a "report" and is included in this count. (A "message/rfc822" is considered an attached message and is handled by the NumAttachedMessages property and the GetAttachedMessage method.) Any MIME sub-part having a Content-Type equal to "text/rfc822-headers" is also considered to be a "report". The GetReport method may be called to get the body content of each "report" contained within a multipart/report email.

top
NumTo
integer
set intVal [CkEmail_get_NumTo $myEmail]

The number of direct email recipients.

More Information and Examples
top
OaepHash
string
# ckStr is a CkString
CkEmail_get_OaepHash $myEmail $ckStr
set strVal [CkEmail_get_oaepHash $myEmail]
CkEmail_put_OaepHash $myEmail $strVal
Introduced in version 9.5.0.67

Selects the hash algorithm for use within OAEP padding when encrypting email using RSAES-OAEP. The valid choices are "sha1", "sha256", "sha384", "sha512",

top
OaepMgfHash
string
# ckStr is a CkString
CkEmail_get_OaepMgfHash $myEmail $ckStr
set strVal [CkEmail_get_oaepMgfHash $myEmail]
CkEmail_put_OaepMgfHash $myEmail $strVal
Introduced in version 9.5.0.71

Selects the MGF hash algorithm for use within OAEP padding when encrypting email using RSAES-OAEP. The valid choices are "sha1", "sha256", "sha384", "sha512",

top
OaepPadding
boolean 1/0
set boolVal [CkEmail_get_OaepPadding $myEmail]
CkEmail_put_OaepPadding $myEmail $boolVal
Introduced in version 9.5.0.67

Selects the RSA encryption scheme when encrypting email. The default value is 0, which selects RSAES_PKCS1-V1_5. If set to 1, then RSAES_OAEP is used.

top
OverwriteExisting
boolean 1/0
set boolVal [CkEmail_get_OverwriteExisting $myEmail]
CkEmail_put_OverwriteExisting $myEmail $boolVal

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

top
Pkcs7CryptAlg
string
# ckStr is a CkString
CkEmail_get_Pkcs7CryptAlg $myEmail $ckStr
set strVal [CkEmail_get_pkcs7CryptAlg $myEmail]
CkEmail_put_Pkcs7CryptAlg $myEmail $strVal

When an email is sent encrypted (using PKCS7 public-key encryption), this selects the underlying symmetric encryption algorithm. Possible values are: "aes", "des", "3des", and "rc2". The default value is "aes".

top
Pkcs7KeyLength
integer
set intVal [CkEmail_get_Pkcs7KeyLength $myEmail]
CkEmail_put_Pkcs7KeyLength $myEmail $intVal

When the email is sent encrypted (using PKCS7 public-key encryption), this selects the key length of the underlying symmetric encryption algorithm. The possible values allowed depend on the Pkcs7CryptAlg property. For "aes", the key length may be 128, 192, or 256. For "3des" the key length must be 192. For "des" the key length must be 40. For "rc2" the key length can be 40, 56, 64, or 128.

top
PreferredCharset
string
# ckStr is a CkString
CkEmail_get_PreferredCharset $myEmail $ckStr
set strVal [CkEmail_get_preferredCharset $myEmail]
CkEmail_put_PreferredCharset $myEmail $strVal

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.

More Information and Examples
top
PrependHeaders
boolean 1/0
set boolVal [CkEmail_get_PrependHeaders $myEmail]
CkEmail_put_PrependHeaders $myEmail $boolVal

If 1, then header fields added via the AddHeaderField or AddHeaderField2 methods are prepended to the top of the header as opposed to appended to the bottom. The default value is 0.

top
ReceivedEncrypted
boolean 1/0
set boolVal [CkEmail_get_ReceivedEncrypted $myEmail]

1 if this email was originally received with encryption, otherwise 0.

top
ReceivedSigned
boolean 1/0
set boolVal [CkEmail_get_ReceivedSigned $myEmail]

1 if this email was originally received with a digital signature, otherwise 0.

More Information and Examples
top
ReplyTo
string
# ckStr is a CkString
CkEmail_get_ReplyTo $myEmail $ckStr
set strVal [CkEmail_get_replyTo $myEmail]
CkEmail_put_ReplyTo $myEmail $strVal

Sets the "Reply-To" header field to the specified email address such as "john@example.com". The Reply-To header automatically defaults to the "From" email address. You would only set this property if you wish for the Reply-To email address to be different from the From address.

There is usually only a single Reply-To email address. If multiple Reply-To addresses are needed, then set with a comma separated list of email addresses such as "john@example.com, mary@somewhere.com".

top
ReturnReceipt
boolean 1/0
set boolVal [CkEmail_get_ReturnReceipt $myEmail]
CkEmail_put_ReturnReceipt $myEmail $boolVal

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

Setting this property causes the "Disposition-Notification-To" email header to be added when the email is sent.

top
SendEncrypted
boolean 1/0
set boolVal [CkEmail_get_SendEncrypted $myEmail]
CkEmail_put_SendEncrypted $myEmail $boolVal

Set to 1 if this email should be sent encrypted.

top
Sender
string
# ckStr is a CkString
CkEmail_get_Sender $myEmail $ckStr
set strVal [CkEmail_get_sender $myEmail]
CkEmail_put_Sender $myEmail $strVal
Introduced in version 9.5.0.41

The sender's address for this email message.

This is the address of the actual sender acting on behalf of the author listed in the From: field. It is the email address passed in the "MAIL FROM" SMTP command which becomes the "return-path" header in the email when received.

Note: The Sender and BounceAddress properties are identical and perform the same function. Setting the Sender property also sets the BounceAddress property, and vice-versa. The reason for the duplication is that BounceAddress existed first, and developers typically searched for a "Sender" property without realizing that the BounceAddress property served this function.

Important Note: This property does not contain the value of the "Sender" header field, if one exists, for a received email. It is a property that is used when sending email. To get the value of the "Sender" header field (which may not always exist), call the GetHeaderField method instead.

top
SendSigned
boolean 1/0
set boolVal [CkEmail_get_SendSigned $myEmail]
CkEmail_put_SendSigned $myEmail $boolVal

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

Note: Please be aware of the Apple Mail bug explained in the web page at the link below.

top
SignaturesValid
boolean 1/0
set boolVal [CkEmail_get_SignaturesValid $myEmail]

1 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 0. (This property is only meaningful when the ReceivedSigned property is equal to 1.)

More Information and Examples
top
SignedBy
string
# ckStr is a CkString
CkEmail_get_SignedBy $myEmail $ckStr
set strVal [CkEmail_get_signedBy $myEmail]

If the email was received digitally signed, this property contains the fields of the cert's SubjectDN.

For example: US, 60187, Illinois, Wheaton, 1719 E Forest Ave, "Chilkat Software, Inc.", "Chilkat Software, Inc."

It is like the DN (Distinguished Name), but without the "AttrName=" before each attribute.

top
SigningAlg
string
# ckStr is a CkString
CkEmail_get_SigningAlg $myEmail $ckStr
set strVal [CkEmail_get_signingAlg $myEmail]
CkEmail_put_SigningAlg $myEmail $strVal
Introduced in version 9.5.0.67

Selects the signature algorithm to be used when sending signed (PKCS7) email. The default value is "PKCS1-v1_5". This can be set to "RSASSA-PSS" (or simply "pss") to use the RSASSA-PSS signature scheme.

Note: This property only applies when signing with an RSA private key. It does not apply for ECC or DSA private keys.

top
SigningHashAlg
string
# ckStr is a CkString
CkEmail_get_SigningHashAlg $myEmail $ckStr
set strVal [CkEmail_get_signingHashAlg $myEmail]
CkEmail_put_SigningHashAlg $myEmail $strVal

Selects the underlying hash algorithm used when sending signed (PKCS7) email. Possible values are "sha1", "sha256", "sha384", "sha512", "md5", and "md2".

top
Size
integer
set intVal [CkEmail_get_Size $myEmail]

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

Note: This property is only valid if the full email was downloaded. If only the header was downloaded, then this property will contain the size of just the header.

top
Subject
string
# ckStr is a CkString
CkEmail_get_Subject $myEmail $ckStr
set strVal [CkEmail_get_subject $myEmail]
CkEmail_put_Subject $myEmail $strVal

The email subject.

top
Uidl
string
# ckStr is a CkString
CkEmail_get_Uidl $myEmail $ckStr
set strVal [CkEmail_get_uidl $myEmail]

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

Important: Emails downloaded via the IMAP protocol do not have UIDL's. UIDL's are specific to the POP3 protocol. IMAP servers use UID's (notice the spelling difference -- "UIDL" vs. "UID"). An email downloaded via the Chilkat IMAP component will contain a "ckx-imap-uid" header field that holds either an IMAP UID or sequence number. If the email was downloaded (from IMAP) using a UID,then ckx-imap-uid contains a UID. If the email was downloaded by sequence number, then it contains a sequence number (not unique and can change with a new session). The "ckx-imap-isUid" header, which can have the value "YES" or "NO", tells what ckx-imap-uid contains.

top
UncommonOptions
string
# ckStr is a CkString
CkEmail_get_UncommonOptions $myEmail $ckStr
set strVal [CkEmail_get_uncommonOptions $myEmail]
CkEmail_put_UncommonOptions $myEmail $strVal
Introduced in version 9.5.0.79

This is a catch-all property to be used for uncommon needs. This property defaults to the empty string, and should typically remain empty.

As of v9.5.0.79, the only possible value is:

  • "NO_FORMAT_FLOWED" - Don't automatically add "format=flowed" to any Content-Type header.

top
UnpackUseRelPaths
boolean 1/0
set boolVal [CkEmail_get_UnpackUseRelPaths $myEmail]
CkEmail_put_UnpackUseRelPaths $myEmail $boolVal

Applies to the UnpackHtml method. If 1, then relative paths are used within the HTML for the links to the related files (images and style sheets) that were unpacked to the filesystem. Otherwise absolute paths are used. The default value is 1.

top
Utf8
boolean 1/0
set boolVal [CkEmail_get_Utf8 $myEmail]
CkEmail_put_Utf8 $myEmail $boolVal

When set to 1, all "const char *" arguments are interpreted as utf-8 strings. If set to 0 (the default), then "const char *" arguments are interpreted as ANSI strings. Also, when set to 1, and Chilkat method returning a "const char *" is returning the utf-8 representation. If set to 0, all "const char *" return values are ANSI strings.

top
VerboseLogging
boolean 1/0
set boolVal [CkEmail_get_VerboseLogging $myEmail]
CkEmail_put_VerboseLogging $myEmail $boolVal

If set to 1, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. The default value is 0. Verbose logging should only be used for debugging. The potentially large quantity of logged information may adversely affect peformance.

top
Version
string
# ckStr is a CkString
CkEmail_get_Version $myEmail $ckStr
set strVal [CkEmail_get_version $myEmail]

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

More Information and Examples
top

Methods

AddAttachmentBd
# filename is a string
# binData is a CkBinData
# contentType is a string
set status [CkEmail_AddAttachmentBd $filename $binData $contentType]
Introduced in version 9.5.0.63

Adds an attachment using the contents of a BinData object. If contentType is empty, then the content-type will be inferred from the filename extension.

Returns 1 for success, 0 for failure.

More Information and Examples
top
AddAttachmentHeader
# index is an integer
# fieldName is a string
# fieldValue is a string
CkEmail_AddAttachmentHeader $index $fieldName $fieldValue

Adds or replaces a MIME header field in one of the email attachments. If the header field does not exist, it is added. Otherwise it is replaced.

More Information and Examples
top
AddBcc
# friendlyName is a string
# emailAddress is a string
set status [CkEmail_AddBcc $friendlyName $emailAddress]

Adds a recipient to the blind carbon-copy list. emailAddress is required, but friendlyName may be empty.

To add multiple BCC recipients, call this method once per recipient.

Returns 1 for success, 0 for failure.

top
AddCC
# friendlyName is a string
# emailAddress is a string
set status [CkEmail_AddCC $friendlyName $emailAddress]

Adds a recipient to the carbon-copy list. emailAddress is required, but friendlyName may be empty.

To add multiple CC recipients, call this method once per recipient.

Returns 1 for success, 0 for failure.

More Information and Examples
top
AddDataAttachment
# fileName is a string
# content is a CkByteData
set status [CkEmail_AddDataAttachment $fileName $content]

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

Returns 1 for success, 0 for failure.

top
AddDataAttachment2
# fileName is a string
# content is a CkByteData
# contentType is a string
set status [CkEmail_AddDataAttachment2 $fileName $content $contentType]

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

Returns 1 for success, 0 for failure.

top
AddEncryptCert
# cert is a CkCert
set status [CkEmail_AddEncryptCert $cert]

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. On Windows computers, the registry-based Current-User and Local-Machine certificate stores are automatically searched for certs matching each of the recipients (To, CC, and BCC recipients).

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

Returns 1 for success, 0 for failure.

top
AddFileAttachment
# path is a string
# outStrContentType is a CkString (output)
set status [CkEmail_AddFileAttachment $path $outStr]
set retStr [CkEmail_addFileAttachment $myEmail $path]

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 1 for success, 0 for failure.

top
AddFileAttachment2
# path is a string
# contentType is a string
set status [CkEmail_AddFileAttachment2 $path $contentType]

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

Returns 1 for success, 0 for failure.

More Information and Examples
top
AddHeaderField
# fieldName is a string
# fieldValue is a string
CkEmail_AddHeaderField $fieldName $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.

Important: This method will replace an already-existing header field. To allow for adding duplicate header fields, call AddHeaderField2 (see below).

top
AddHeaderField2
# fieldName is a string
# fieldValue is a string
CkEmail_AddHeaderField2 $fieldName $fieldValue

This method is the same as AddHeaderField, except that if the header field already exists, it is not replaced. A duplicate header will be added.

top
AddHtmlAlternativeBody
# body is a string
set status [CkEmail_AddHtmlAlternativeBody $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.

Returns 1 for success, 0 for failure.

More Information and Examples
top
AddiCalendarAlternativeBody
# icalContent is a string
# methodName is a string
set status [CkEmail_AddiCalendarAlternativeBody $icalContent $methodName]

Adds an iCalendar (text/calendar) alternative body to the email. The icalContent contains the content of the iCalendar data. A sample is shown here:

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//hacksw/handcal//NONSGML v1.0//EN
BEGIN:VEVENT
UID:uid1@example.com
DTSTAMP:19970714T170000Z
ORGANIZER;CN=John Doe:MAILTO:john.doe@example.com
DTSTART:19970714T170000Z
DTEND:19970715T035959Z
SUMMARY:Bastille Day Party
END:VEVENT
END:VCALENDAR
The methodName is the "method" attribute used in the Content-Type header field in the alternative body. For example, if set to "REQUEST", then the alternative body's header would look like this:
Content-Type: text/calendar; method=REQUEST
Content-Transfer-Encoding: base64

Returns 1 for success, 0 for failure.

top
AddMultipleBcc
# commaSeparatedAddresses is a string
set status [CkEmail_AddMultipleBcc $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.

Returns 1 for success, 0 for failure.

top
AddMultipleCC
# commaSeparatedAddresses is a string
set status [CkEmail_AddMultipleCC $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.

Returns 1 for success, 0 for failure.

top
AddMultipleTo
# commaSeparatedAddresses is a string
set status [CkEmail_AddMultipleTo $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.

Returns 1 for success, 0 for failure.

top
AddPfxSourceData
# pfxBytes is a CkByteData
# pfxPassword is a string
set status [CkEmail_AddPfxSourceData $pfxBytes $pfxPassword]

Adds a PFX to the object's internal list of sources to be searched for certificates and private keys when decrypting. Multiple PFX sources can be added by calling this method once for each. (On the Windows operating system, the registry-based certificate stores are also automatically searched, so it is commonly not required to explicitly add PFX sources.)

The pfxBytes contains the bytes of a PFX file (also known as PKCS12 or .p12).

Returns 1 for success, 0 for failure.

top
AddPfxSourceFile
# pfxFilePath is a string
# pfxPassword is a string
set status [CkEmail_AddPfxSourceFile $pfxFilePath $pfxPassword]

Adds a PFX file to the object's internal list of sources to be searched for certificates and private keys when decrypting. Multiple PFX files can be added by calling this method once for each. (On the Windows operating system, the registry-based certificate stores are also automatically searched, so it is commonly not required to explicitly add PFX sources.)

The pfxFilePath contains the bytes of a PFX file (also known as PKCS12 or .p12).

Returns 1 for success, 0 for failure.

top
AddPlainTextAlternativeBody
# body is a string
set status [CkEmail_AddPlainTextAlternativeBody $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.

Returns 1 for success, 0 for failure.

More Information and Examples
top
AddRelatedBd
# filename is a string
# binData is a CkBinData
# outStr is a CkString (output)
set status [CkEmail_AddRelatedBd $filename $binData $outStr]
set retStr [CkEmail_addRelatedBd $myEmail $filename $binData]
Introduced in version 9.5.0.65

Adds a related item using the contents of a BinData object. Returns the Content-ID for the newly added relted item.

Returns 1 for success, 0 for failure.

More Information and Examples
top
AddRelatedBd2
# binData is a CkBinData
# fileNameInHtml is a string
set status [CkEmail_AddRelatedBd2 $binData $fileNameInHtml]
Introduced in version 9.5.0.65

Adds a related item using the contents of a BinData object. The fileNameInHtml should be set to the filename/path/url used in the corresponding HTML IMG tag's "src" attribute.

Returns 1 for success, 0 for failure.

More Information and Examples
top
AddRelatedData
# fileName is a string
# inData is a CkByteData
# outStr is a CkString (output)
set status [CkEmail_AddRelatedData $fileName $inData $outStr]
set retStr [CkEmail_addRelatedData $myEmail $fileName $inData]

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 1 for success, 0 for failure.

top
AddRelatedData2
# inData is a CkByteData
# fileNameInHtml is a string
CkEmail_AddRelatedData2 $inData $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.

top
AddRelatedFile
# path is a string
# outStrContentID is a CkString (output)
set status [CkEmail_AddRelatedFile $path $outStr]
set retStr [CkEmail_addRelatedFile $myEmail $path]

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 1 for success, 0 for failure.

top
AddRelatedFile2
# filenameOnDisk is a string
# filenameInHtml is a string
set status [CkEmail_AddRelatedFile2 $filenameOnDisk $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. The filenameOnDisk is the path in the local filesystem of the file to be added.

Note: Outlook.com will not properly display embedded HTMl images when the filenameInHtml includes a path part. Apparently, Outlook.com is only capable of correctly displaying images when the filenameInHtml is a only a filename. Other email clients, such as Mozilla Thunderbird, have no trouble when the filenameInHtml includes a path part.

Returns 1 for success, 0 for failure.

More Information and Examples
top
AddRelatedHeader
# index is an integer
# fieldName is a string
# fieldValue is a string
CkEmail_AddRelatedHeader $index $fieldName $fieldValue

Adds or replaces a MIME header field in one of the email's related items. If the header field does not exist, it is added. Otherwise it is replaced.

top
AddRelatedString
# nameInHtml is a string
# str is a string
# charset is a string
# outCid is a CkString (output)
set status [CkEmail_AddRelatedString $nameInHtml $str $charset $outStr]
set retStr [CkEmail_addRelatedString $myEmail $nameInHtml $str $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.

Returns 1 for success, 0 for failure.

top
AddRelatedString2
# fileNameInHtml is a string
# content is a string
# charset is a string
CkEmail_AddRelatedString2 $fileNameInHtml $content $charset

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.

top
AddStringAttachment
# path is a string
# content is a string
set status [CkEmail_AddStringAttachment $path $content]

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

Returns 1 for success, 0 for failure.

More Information and Examples
top
AddStringAttachment2
# path is a string
# content is a string
# charset is a string
set status [CkEmail_AddStringAttachment2 $path $content $charset]

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

Note: Beginning in v9.5.0.48, the charset may be prepended with "bom-" or "no-bom-" to include or exclude the BOM (preamble) for charsets such as utf-16 or utf-8. For example: "no-bom-utf-8" or "bom-utf-8".

Returns 1 for success, 0 for failure.

top
AddTo
# friendlyName is a string
# emailAddress is a string
set status [CkEmail_AddTo $friendlyName $emailAddress]

Adds a recipient to the "to" list. emailAddress is required, but friendlyName may be empty. Emails that have no "To" recipients will be sent to <undisclosed-recipients>.

To add multiple recipients, call this method once per TO recipient.

Returns 1 for success, 0 for failure.

More Information and Examples
top
AesDecrypt
# password is a string
set status [CkEmail_AesDecrypt $password]

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

Returns 1 for success, 0 for failure.

top
AesEncrypt
# password is a string
set status [CkEmail_AesEncrypt $password]

Encrypts the email body, all alternative bodies, all message sub-parts and attachments using 128-bit AES CBC encryption. Decrypting is achieved by calling AesDecrypt with the same password. The AesEncrypt/Decrypt methods use symmetric password-based AES encryption and greatly simplify sending and receiving encrypted emails because certificates and private keys are not used. However, the sending and receiving applications must both use Chilkat, and the password must be pre-known on both ends.

Returns 1 for success, 0 for failure.

top
AppendToBody
# str is a string
CkEmail_AppendToBody $str

Appends a string to the plain-text body.

top
ApplyFixups
# fixups is a string
set status [CkEmail_ApplyFixups $fixups]
Introduced in version 9.5.0.71

Sometimes emails created by other software or systems are not formatted according to typical conventions. This method provides a means to automatically fix certain problems.

The fixups set to a comma-separated list of keywords that identify the fixups to be applied. At the moment, there is only one fixup defined ("FixRelated") as described here:

  • FixRelated: Fixes the email so that HTML related items (images for example) are properly located in the email MIME structure. This prevents them from being seen as attachments.
  • Returns 1 for success, 0 for failure.

    top
AspUnpack
# prefix is a string
# saveDir is a string
# urlPath is a string
# cleanFiles is a boolean
set status [CkEmail_AspUnpack $prefix $saveDir $urlPath $cleanFiles]

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

Returns 1 for success, 0 for failure.

top
AspUnpack2
# prefix is a string
# saveDir is a string
# urlPath is a string
# cleanFiles is a boolean
# outHtml is a CkByteData (output)
set status [CkEmail_AspUnpack2 $prefix $saveDir $urlPath $cleanFiles $outData]

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

Returns 1 for success, 0 for failure.

top
AttachEmail
# email is a CkEmail
set status [CkEmail_AttachEmail $email]
Introduced in version 9.5.0.87

Attaches copy of the email to this email object. The attached email will be encapsulated in an message/rfc822 sub-part.

Returns 1 for success, 0 for failure.

top
AttachMessage
# mimeBytes is a CkByteData
set status [CkEmail_AttachMessage $mimeBytes]

Attaches a MIME message to the email object. The attached MIME will be encapsulated in an message/rfc822 sub-part.

Returns 1 for success, 0 for failure.

top
BEncodeBytes
# inData is a CkByteData
# charset is a string
# outEncodedStr is a CkString (output)
set status [CkEmail_BEncodeBytes $inData $charset $outStr]
set retStr [CkEmail_bEncodeBytes $myEmail $inData $charset]

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

Returns 1 for success, 0 for failure.

top
BEncodeString
# str is a string
# charset is a string
# outEncodedStr is a CkString (output)
set status [CkEmail_BEncodeString $str $charset $outStr]
set retStr [CkEmail_bEncodeString $myEmail $str $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.

Returns 1 for success, 0 for failure.

top
Clear
CkEmail_Clear
Introduced in version 9.5.0.76

Clears the email object of all information to the state as if the object was just created, which will have default headers such as Mime-Version, Date, Message-ID, Content-Type, Content-Transfer-Encoding, and X-Priority.

top
ClearBcc
CkEmail_ClearBcc

Clears the list of blind carbon-copy recipients.

top
ClearCC
CkEmail_ClearCC

Clears the list of carbon-copy recipients.

top
ClearEncryptCerts
CkEmail_ClearEncryptCerts

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

top
ClearTo
CkEmail_ClearTo

Clears the list of "to" recipients.

top
Clone
# returns a CkEmail
set ret_email [CkEmail_Clone]

Creates and returns an identical copy of the Email object.

Returns NULL on failure

top
ComputeGlobalKey2
# encoding is a string
# bFold is a boolean
# outStr is a CkString (output)
set status [CkEmail_ComputeGlobalKey2 $encoding $bFold $outStr]
set retStr [CkEmail_computeGlobalKey2 $myEmail $encoding $bFold]
Introduced in version 9.5.0.59

Computes a global unique key for the email. The key is created by a digest-MD5 hash of the concatenation of the following:

messageID + CRLF + subject + CRLF + from + CRLF + date + CRLF + recipientAddrs

messageID contains the contents of the Message-ID header field.
subject contains the contents of the Subject header field, trimmed of whitespace from both ends, 
    where TAB chars are converted to SPACE chars, and internal whitespace is trimmed so that 
   no more than one SPACE char in a row exists.
from contains the lowercase FROM header email address.
date contains the contents of the DATE header field.
toAddrs contains lowercase TO and CC recipient email addresses, comma separated, with duplicates removed, and sorted 
    in ascending order.  The BCC addresses are NOT included.

(After calling this method, the LastErrorText property can be examined to see the string that was hashed.)
The 16-byte MD5 hash is returned as an encoded string. The encoding determines the encoding: base64, hex, url, etc. If bFold is 1, then the 16-byte MD5 hash is folded to 8 bytes with an XOR to produce a shorter key.

Returns 1 for success, 0 for failure.

top
ConvertInlineImages
set status [CkEmail_ConvertInlineImages]
Introduced in version 9.5.0.78

Converts images embedded inline within HTML to multipart/related MIME parts referenced from the HTML by CID.

Returns 1 for success, 0 for failure.

top
CreateDsn
# returns a CkEmail
# humanReadableMessage is a string
# xmlStatusFields is a string
# bHeaderOnly is a boolean
set ret_email [CkEmail_CreateDsn $humanReadableMessage $xmlStatusFields $bHeaderOnly]

Creates a new DSN (Delivery Status Notification) email having the format as specified in RFC 3464. See the example (below) for more detailed information.

Returns NULL on failure

top
CreateForward
# returns a CkEmail
set ret_email [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 NULL on failure

top
CreateMdn
# returns a CkEmail
# humanReadableMessage is a string
# xmlStatusFields is a string
# bHeaderOnly is a boolean
set ret_email [CkEmail_CreateMdn $humanReadableMessage $xmlStatusFields $bHeaderOnly]

Creates a new MDN (Message Disposition Notification) email having the format as specified in RFC 3798. See the example (below) for more detailed information.

Returns NULL on failure

top
CreateReply
# returns a CkEmail
set ret_email [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.

Note: Attachments are not included in the returned reply email. However, attached messages are included. If an application does not wish to include the attached messages in a reply email, they can be removed by calling RemoveAttachedMessages on the reply email object.

Returns NULL on failure

top
CreateTempMht
# inFilename is a string
# outPath is a CkString (output)
set status [CkEmail_CreateTempMht $inFilename $outStr]
set retStr [CkEmail_createTempMht $myEmail $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.

Returns 1 for success, 0 for failure.

top
DropAttachments
CkEmail_DropAttachments

Removes all attachments from the email.

top
DropRelatedItem
# index is an integer
CkEmail_DropRelatedItem $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.

top
DropRelatedItems
CkEmail_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.

top
DropSingleAttachment
# index is an integer
set status [CkEmail_DropSingleAttachment $index]

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

Returns 1 for success, 0 for failure.

top
FindIssuer
# returns a CkCert
# cert is a CkCert
set ret_cert [CkEmail_FindIssuer $cert]

Digitally signed and/or encrypted emails are automatically "unwrapped" when received from a POP3 or IMAP server, or when loaded from any source such as a MIME string, in-memory byte data, or a .eml file. The results of the signature verification / decryption are stored in the properties such as ReceivedSigned, ReceivedEncrypted, SignaturesValid, etc. The signing certificate can be obtained via the GetSigningCert function. If the signature contained more certificates in the chain of authentication, this method provides a means to access them.

During signature verification, the email object collects the certs found in the signature and holds onto them internally. To get the issuing certificate of the signing certificate, call this method passing the cert returned by GetSigningCert. If the issuing cert is available, it is returned. Otherwise NULL is returned. If the cert passed in is the root (i.e. a self-signed certificate), then the cert object returned is a copy of the cert passed in.

To traverse the chain to the root, one would write a loop that on first iteration passes the cert returned by GetSignedByCert (not GetSignerCert), and then on each subsequent iteration passes the cert from the previous iteration. The loop would exit when a cert is returned that has the same SubjectDN and SerialNumber as what was passed in (or when FindIssuer returns NULL).

Returns NULL on failure

top
GenerateFilename
# outStrFilename is a CkString (output)
set status [CkEmail_GenerateFilename $outStr]
set retStr [CkEmail_generateFilename $myEmail]

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

Returns 1 for success, 0 for failure.

top
GetAlternativeBody
# index is an integer
# outStrBody is a CkString (output)
set status [CkEmail_GetAlternativeBody $index $outStr]
set retStr [CkEmail_getAlternativeBody $myEmail $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.

Returns 1 for success, 0 for failure.

top
GetAlternativeBodyBd
# index is an integer
# binData is a CkBinData
set status [CkEmail_GetAlternativeBodyBd $index $binData]
Introduced in version 9.5.0.67

Returns contents of the Nth alternative body to binData. The 1st alternative body is at index 0. This method should only be called when the NumAlternatives property has a value greater than 0.

Returns 1 for success, 0 for failure.

top
GetAlternativeBodyByContentType
# contentType is a string
# outStr is a CkString (output)
set status [CkEmail_GetAlternativeBodyByContentType $contentType $outStr]
set retStr [CkEmail_getAlternativeBodyByContentType $myEmail $contentType]

Returns the alternative body by content-type, such as "text/plain", "text/html", "text/xml", etc.

Returns 1 for success, 0 for failure.

top
GetAlternativeContentType
# index is an integer
# outStrContentType is a CkString (output)
set status [CkEmail_GetAlternativeContentType $index $outStr]
set retStr [CkEmail_getAlternativeContentType $myEmail $index]

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

Returns 1 for success, 0 for failure.

top
GetAltHeaderField
# index is an integer
# fieldName is a string
# outStr is a CkString (output)
set status [CkEmail_GetAltHeaderField $index $fieldName $outStr]
set retStr [CkEmail_getAltHeaderField $myEmail $index $fieldName]

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

Returns 1 for success, 0 for failure.

top
GetAttachedMessage
# returns a CkEmail
# index is an integer
set ret_email [CkEmail_GetAttachedMessage $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 NULL on failure

top
GetAttachedMessageAttr
# index is an integer
# fieldName is a string
# attrName is a string
# outStr is a CkString (output)
set status [CkEmail_GetAttachedMessageAttr $index $fieldName $attrName $outStr]
set retStr [CkEmail_getAttachedMessageAttr $myEmail $index $fieldName $attrName]
Introduced in version 9.5.0.41

Returns a header field attribute value for the Nth attached (embedded) email. For example, to get the value of the "name" attribute in the Content-Type header for the 1st attached message:

Content-Type: message/rfc822; name="md75000024149.eml"
then the method arguments should contain the values 0, "Content-Type", "name".

Returns 1 for success, 0 for failure.

top
GetAttachedMessageFilename
# index is an integer
# outStr is a CkString (output)
set status [CkEmail_GetAttachedMessageFilename $index $outStr]
set retStr [CkEmail_getAttachedMessageFilename $myEmail $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.

Important: The attached message filename is only present if the Content-Disposition header exists AND contains a "filename" attribute. If questions arise, one could open the email in a text editor to examine the MIME sub-header for the attached message (where the Content-Type = "message/rfc822"). For example, here is a sub-header that has a filename:

Content-Type: message/rfc822; name="GetAttachedMessageAttr.eml"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="GetAttachedMessageAttr.eml"
Here is an attached message sub-header that does NOT have a filename:
Content-Type: message/rfc822
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment

Returns 1 for success, 0 for failure.

top
GetAttachmentAttr
# index is an integer
# fieldName is a string
# attrName is a string
# outStr is a CkString (output)
set status [CkEmail_GetAttachmentAttr $index $fieldName $attrName $outStr]
set retStr [CkEmail_getAttachmentAttr $myEmail $index $fieldName $attrName]
Introduced in version 9.5.0.41

Returns a header field attribute value from the header field of the Nth attachment.

Returns 1 for success, 0 for failure.

top
GetAttachmentBd
# index is an integer
# binData is a CkBinData
set status [CkEmail_GetAttachmentBd $index $binData]
Introduced in version 9.5.0.67

Copies an attachment's binary data into binData. The first attachment is at index 0.

Returns 1 for success, 0 for failure.

top
GetAttachmentContentID
# index is an integer
# outStrContentID is a CkString (output)
set status [CkEmail_GetAttachmentContentID $index $outStr]
set retStr [CkEmail_getAttachmentContentID $myEmail $index]

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

Returns 1 for success, 0 for failure.

top
GetAttachmentContentType
# index is an integer
# outStrContentType is a CkString (output)
set status [CkEmail_GetAttachmentContentType $index $outStr]
set retStr [CkEmail_getAttachmentContentType $myEmail $index]

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

Returns 1 for success, 0 for failure.

top
GetAttachmentData
# index is an integer
# outData is a CkByteData (output)
set status [CkEmail_GetAttachmentData $index $outData]

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

Returns 1 for success, 0 for failure.

top
GetAttachmentFilename
# index is an integer
# outStrFilename is a CkString (output)
set status [CkEmail_GetAttachmentFilename $index $outStr]
set retStr [CkEmail_getAttachmentFilename $myEmail $index]

Retrieves an attachment's filename.

Returns 1 for success, 0 for failure.

top
GetAttachmentHeader
# attachIndex is an integer
# fieldName is a string
# outFieldValue is a CkString (output)
set status [CkEmail_GetAttachmentHeader $attachIndex $fieldName $outStr]
set retStr [CkEmail_getAttachmentHeader $myEmail $attachIndex $fieldName]

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

Returns 1 for success, 0 for failure.

top
GetAttachmentSize
# index is an integer
set retInt [CkEmail_GetAttachmentSize $index]

Returns the size (in bytes) of the Nth attachment. The 1st attachment is at index 0. Returns -1 if there is no attachment at the specified index.

top
GetAttachmentString
# index is an integer
# charset is a string
# outStr is a CkString (output)
set status [CkEmail_GetAttachmentString $index $charset $outStr]
set retStr [CkEmail_getAttachmentString $myEmail $index $charset]

Retrieves an attachment's data as a String. All CRLF sequences will be translated to single newline characters. The charset indicates how to interpret the bytes of the attachment. For example, if the attachment is a text file using the utf-8 byte representation for characters, pass "utf-8".

Returns 1 for success, 0 for failure.

top
GetAttachmentStringCrLf
# index is an integer
# charset is a string
# outStrData is a CkString (output)
set status [CkEmail_GetAttachmentStringCrLf $index $charset $outStr]
set retStr [CkEmail_getAttachmentStringCrLf $myEmail $index $charset]

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

Returns 1 for success, 0 for failure.

top
GetBcc
# index is an integer
# outStr is a CkString (output)
set status [CkEmail_GetBcc $index $outStr]
set retStr [CkEmail_getBcc $myEmail $index]

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

Returns 1 for success, 0 for failure.

More Information and Examples
top
GetBccAddr
# index is an integer
# outStr is a CkString (output)
set status [CkEmail_GetBccAddr $index $outStr]
set retStr [CkEmail_getBccAddr $myEmail $index]

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

Returns 1 for success, 0 for failure.

More Information and Examples
top
GetBccName
# index is an integer
# outStr is a CkString (output)
set status [CkEmail_GetBccName $index $outStr]
set retStr [CkEmail_getBccName $myEmail $index]

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

Returns 1 for success, 0 for failure.

More Information and Examples
top
GetCC
# index is an integer
# outStr is a CkString (output)
set status [CkEmail_GetCC $index $outStr]
set retStr [CkEmail_getCC $myEmail $index]

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

Returns 1 for success, 0 for failure.

More Information and Examples
top
GetCcAddr
# index is an integer
# outStr is a CkString (output)
set status [CkEmail_GetCcAddr $index $outStr]
set retStr [CkEmail_getCcAddr $myEmail $index]

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

Returns 1 for success, 0 for failure.

top
GetCcName
# index is an integer
# outStr is a CkString (output)
set status [CkEmail_GetCcName $index $outStr]
set retStr [CkEmail_getCcName $myEmail $index]

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

Returns 1 for success, 0 for failure.

top
GetDeliveryStatusInfo
# fieldName is a string
# outFieldValue is a CkString (output)
set status [CkEmail_GetDeliveryStatusInfo $fieldName $outStr]
set retStr [CkEmail_getDeliveryStatusInfo $myEmail $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 1.

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 1 for success, 0 for failure.

top
GetDigest
# returns a CkEmail
# index is an integer
set ret_email [CkEmail_GetDigest $index]
Introduced in version 9.5.0.66

Returns an digest contained within a multipart/digest as an email object. The 1st digest is at index 0. Use the NumDigests property to get the number of digests available.

Note: This example requires Chilkat v9.5.0.66 or greater.

Returns NULL on failure

More Information and Examples
top
GetDsnFinalRecipients
# returns a CkStringArray
set ret_stringArray [CkEmail_GetDsnFinalRecipients]

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

Returns NULL on failure

top
GetDt
# returns a CkDateTime
set ret_ckDateTime [CkEmail_GetDt]

Returns the date/time found in the "Date" header field as a date/time object.

Returns NULL on failure

More Information and Examples
top
GetEncryptCert
# returns a CkCert
set ret_cert [CkEmail_GetEncryptCert]

Returns the certificate that was previously set by SetEncryptCert.

Returns NULL on failure

top
GetEncryptedByCert
# returns a CkCert
set ret_cert [CkEmail_GetEncryptedByCert]

Returns the certificate associated with a received encrypted email.

Returns NULL on failure

top
GetFileContent
# path is a string
# outData is a CkByteData (output)
set status [CkEmail_GetFileContent $path $outData]

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

Returns 1 for success, 0 for failure.

top
GetHeaderField
# fieldName is a string
# outStrFieldData is a CkString (output)
set status [CkEmail_GetHeaderField $fieldName $outStr]
set retStr [CkEmail_getHeaderField $myEmail $fieldName]

Returns the value of a header field.

Returns 1 for success, 0 for failure.

top
GetHeaderFieldName
# index is an integer
# outStrFieldName is a CkString (output)
set status [CkEmail_GetHeaderFieldName $index $outStr]
set retStr [CkEmail_getHeaderFieldName $myEmail $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.

The 1st header field is at index 0. (All Chilkat indexing is 0-based.)

Returns 1 for success, 0 for failure.

More Information and Examples
top
GetHeaderFieldValue
# index is an integer
# outStrFieldValue is a CkString (output)
set status [CkEmail_GetHeaderFieldValue $index $outStr]
set retStr [CkEmail_getHeaderFieldValue $myEmail $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.

The 1st header field is at index 0, the last header field is at index NumHeaderFields-1. (All Chilkat indexing is 0-based.)

Returns 1 for success, 0 for failure.

top
GetHtmlBody
# outStrBody is a CkString (output)
set status [CkEmail_GetHtmlBody $outStr]
set retStr [CkEmail_getHtmlBody $myEmail]

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

Returns 1 for success, 0 for failure.

top
GetImapUid
set retInt [CkEmail_GetImapUid]

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 0xFFFFFFFF.

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.

Note:If an email was downloaded from the IMAP server in a way such that the UID is not received, then there will be no "ckx-imap-uid" header field and this method would return 0xFFFFFFFF. For example, if emails are downloaded by sequence numbers via the Imap.FetchSequence method, then UIDs are not used and therefore the email object will not contain this information.

top
GetLinkedDomains
# returns a CkStringArray
set ret_stringArray [CkEmail_GetLinkedDomains]

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

Returns NULL on failure

top
GetMbHeaderField
# fieldName is a string
# charset is a string
# outBytes is a CkByteData (output)
set status [CkEmail_GetMbHeaderField $fieldName $charset $outData]

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.

The 1st header field is at index 0. (All Chilkat indexing is 0-based.)

Returns 1 for success, 0 for failure.

top
GetMbHtmlBody
# charset is a string
# outData is a CkByteData (output)
set status [CkEmail_GetMbHtmlBody $charset $outData]

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 1 for success, 0 for failure.

top
GetMbPlainTextBody
# charset is a string
# outData is a CkByteData (output)
set status [CkEmail_GetMbPlainTextBody $charset $outData]

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

Returns 1 for success, 0 for failure.

top
GetMime
# outStrMime is a CkString (output)
set status [CkEmail_GetMime $outStr]
set retStr [CkEmail_getMime $myEmail]

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

Returns 1 for success, 0 for failure.

top
GetMimeBd
# bindat is a CkBinData
set status [CkEmail_GetMimeBd $bindat]
Introduced in version 9.5.0.62

Return the email as binary MIME containing the email header, body (or bodies), related items (if any), and all attachments. The MIME is appended to the existing contents (if any) of bindat.

Returns 1 for success, 0 for failure.

top
GetMimeBinary
# outBytes is a CkByteData (output)
set status [CkEmail_GetMimeBinary $outData]

Returns the full MIME of an email.

Returns 1 for success, 0 for failure.

top
GetMimeSb
# sb is a CkStringBuilder
set status [CkEmail_GetMimeSb $sb]
Introduced in version 9.5.0.62

Return the email as MIME text containing the email header, body (or bodies), related items (if any), and all attachments. The MIME is appended to the existing contents (if any) of sb.

Returns 1 for success, 0 for failure.

More Information and Examples
top
GetNthBinaryPartOfType
# index is an integer
# contentType is a string
# inlineOnly is a boolean
# excludeAttachments is a boolean
# outBytes is a CkByteData (output)
set status [CkEmail_GetNthBinaryPartOfType $index $contentType $inlineOnly $excludeAttachments $outData]
Introduced in version 9.5.0.44

Returns the binary bytes of the Nth MIME sub-part having a specified content type (such as "application/pdf". Indexing begins at 0. Call GetNumPartsOfType to find out how many MIME sub-parts exist for any given content type. If inlineOnly is 1, then only MIME sub-parts having a content-disposition of "inline" are included. If excludeAttachments is 1, then MIME sub-parts having a content-disposition of "attachment" are excluded.

Note: If the email was downloaded as header-only, it will not contain all the parts of the full email. Also, if downloaded from IMAP excluding attachments, those parts that are the attachments will (of course) be missing.

Note: Beginning in v9.5.0.95, the contentType can be wildcarded. For example, it is possible to specify "text/*", or simply "*" to match any Content-Type.

Note: Only non-multipart MIME parts are matched.

Returns 1 for success, 0 for failure.

top
GetNthBinaryPartOfTypeBd
# index is an integer
# contentType is a string
# inlineOnly is a boolean
# excludeAttachments is a boolean
# bd is a CkBinData
set status [CkEmail_GetNthBinaryPartOfTypeBd $index $contentType $inlineOnly $excludeAttachments $bd]
Introduced in version 9.5.0.95

Loads bd with the binary bytes of the Nth MIME sub-part matching the contentType, which can be an exact Content-Type such as "application/pdf", or a wildcarded Content-Type such as "application/*", or "*/*". Indexing begins at 0. Call GetNumPartsOfType to find out how many MIME sub-parts exist for any given content type. If inlineOnly is 1, then only MIME sub-parts having a content-disposition of "inline" are included. If excludeAttachments is 1, then MIME sub-parts having a content-disposition of "attachment" are excluded.

Note: If the email was downloaded as header-only, it will not contain all the parts of the full email. Also, if downloaded from IMAP excluding attachments, those parts that are the attachments will (of course) be missing.

Note: Beginning in v9.5.0.95, the contentType can be wildcarded. For example, it is possible to specify "text/*", or simply "*" to match any Content-Type.

Note: Only non-multipart MIME parts are matched.

Returns 1 for success, 0 for failure.

More Information and Examples
top
GetNthContentType
# index is an integer
# contentType is a string
# inlineOnly is a boolean
# excludeAttachments is a boolean
# outStr is a CkString (output)
set status [CkEmail_GetNthContentType $index $contentType $inlineOnly $excludeAttachments $outStr]
set retStr [CkEmail_getNthContentType $myEmail $index $contentType $inlineOnly $excludeAttachments]
Introduced in version 9.5.0.95

Returns the Content-Type of the Nth MIME sub-part matching the specified contentType. The contentType can be a Content-Type such as "text/plain", or a wildcarded Content-Type such as "text/*", or even just "*" to match all Content-Types. If inlineOnly is 1, then only MIME sub-parts having a content-disposition of "inline" are included. If excludeAttachments is 1, then MIME sub-parts having a content-disposition of "attachment" are excluded.

Note: Only non-multipart content-types are matched.

Returns 1 for success, 0 for failure.

More Information and Examples
top
GetNthTextPartOfType
# index is an integer
# contentType is a string
# inlineOnly is a boolean
# excludeAttachments is a boolean
# outStr is a CkString (output)
set status [CkEmail_GetNthTextPartOfType $index $contentType $inlineOnly $excludeAttachments $outStr]
set retStr [CkEmail_getNthTextPartOfType $myEmail $index $contentType $inlineOnly $excludeAttachments]
Introduced in version 9.5.0.44

Returns the text of the Nth MIME sub-part having a specified content type (such as "text/plain". Indexing begins at 0. Call GetNumPartsOfType to find out how many MIME sub-parts exist for any given content type. If inlineOnly is 1, then only MIME sub-parts having a content-disposition of "inline" are included. If excludeAttachments is 1, then MIME sub-parts having a content-disposition of "attachment" are excluded.

Note: If the email was downloaded as header-only, it will not contain all the parts of the full email. Also, if downloaded from IMAP excluding attachments, those parts that are the attachments will (of course) be missing.

Note: Beginning in v9.5.0.95, the contentType can be wildcarded. For example, it is possible to specify "text/*", or simply "*" to match any Content-Type.

Note: Only non-multipart MIME parts are matched.

Returns 1 for success, 0 for failure.

More Information and Examples
top
GetNumPartsOfType
# contentType is a string
# inlineOnly is a boolean
# excludeAttachments is a boolean
set retInt [CkEmail_GetNumPartsOfType $contentType $inlineOnly $excludeAttachments]
Introduced in version 9.5.0.44

Returns the number of MIME sub-parts within the email having a specified content type (such as "text/plain"). If inlineOnly is 1, then only MIME sub-parts having a content-disposition of "inline" are included. If excludeAttachments is 1, then MIME sub-parts having a content-disposition of "attachment" are excluded.

Note: If the email was downloaded as header-only, it will not contain all the parts of the full email. Also, if downloaded from IMAP excluding attachments, those parts that are the attachments will (of course) be missing.

Note: Beginning in v9.5.0.95, the inlineOnly can be wildcarded. For example, it is possible to specify "text/*", or simply "*" to match any Content-Type.

Note: Only non-multipart MIME parts are matched (i.e. leaf-node MIME parts that contain a text or binary body).

More Information and Examples
top
GetPlainTextBody
# outStrBody is a CkString (output)
set status [CkEmail_GetPlainTextBody $outStr]
set retStr [CkEmail_getPlainTextBody $myEmail]

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

Returns 1 for success, 0 for failure.

top
GetRelatedAttr
# index is an integer
# fieldName is a string
# attrName is a string
# outStr is a CkString (output)
set status [CkEmail_GetRelatedAttr $index $fieldName $attrName $outStr]
set retStr [CkEmail_getRelatedAttr $myEmail $index $fieldName $attrName]
Introduced in version 9.5.0.41

Returns a header field attribute value from the header field of the Nth related item.

Returns 1 for success, 0 for failure.

top
GetRelatedContentID
# index is an integer
# outStrContentID is a CkString (output)
set status [CkEmail_GetRelatedContentID $index $outStr]
set retStr [CkEmail_getRelatedContentID $myEmail $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.

Returns 1 for success, 0 for failure.

top
GetRelatedContentLocation
# index is an integer
# outStr is a CkString (output)
set status [CkEmail_GetRelatedContentLocation $index $outStr]
set retStr [CkEmail_getRelatedContentLocation $myEmail $index]

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 1 for success, 0 for failure.

top
GetRelatedContentType
# index is an integer
# outStrContentType is a CkString (output)
set status [CkEmail_GetRelatedContentType $index $outStr]
set retStr [CkEmail_getRelatedContentType $myEmail $index]

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

Returns 1 for success, 0 for failure.

top
GetRelatedData
# index is an integer
# outBuffer is a CkByteData (output)
set status [CkEmail_GetRelatedData $index $outData]

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

Returns 1 for success, 0 for failure.

top
GetRelatedFilename
# index is an integer
# outStrFilename is a CkString (output)
set status [CkEmail_GetRelatedFilename $index $outStr]
set retStr [CkEmail_getRelatedFilename $myEmail $index]

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

Returns 1 for success, 0 for failure.

top
GetRelatedHeader
# index is an integer
# fieldName is a string
# outStr is a CkString (output)
set status [CkEmail_GetRelatedHeader $index $fieldName $outStr]
set retStr [CkEmail_getRelatedHeader $myEmail $index $fieldName]
Introduced in version 10.0.0

Returns the value of a header field (by name) of a related item.

Returns 1 for success, 0 for failure.

top
GetRelatedString
# index is an integer
# charset is a string
# outStrData is a CkString (output)
set status [CkEmail_GetRelatedString $index $charset $outStr]
set retStr [CkEmail_getRelatedString $myEmail $index $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.

Returns 1 for success, 0 for failure.

top
GetRelatedStringCrLf
# index is an integer
# charset is a string
# outStr is a CkString (output)
set status [CkEmail_GetRelatedStringCrLf $index $charset $outStr]
set retStr [CkEmail_getRelatedStringCrLf $myEmail $index $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.

Returns 1 for success, 0 for failure.

top
GetReplacePattern
# index is an integer
# outStrPattern is a CkString (output)
set status [CkEmail_GetReplacePattern $index $outStr]
set retStr [CkEmail_getReplacePattern $myEmail $index]

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

Returns 1 for success, 0 for failure.

More Information and Examples
top
GetReplaceString
# index is an integer
# outStr is a CkString (output)
set status [CkEmail_GetReplaceString $index $outStr]
set retStr [CkEmail_getReplaceString $myEmail $index]

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

Note: This method was found to not be working correctly and is fixed in Chilkat v9.5.0.91.

Returns 1 for success, 0 for failure.

More Information and Examples
top
GetReplaceString2
# pattern is a string
# outStr is a CkString (output)
set status [CkEmail_GetReplaceString2 $pattern $outStr]
set retStr [CkEmail_getReplaceString2 $myEmail $pattern]

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

Returns 1 for success, 0 for failure.

More Information and Examples
top
GetReport
# index is an integer
# outStr is a CkString (output)
set status [CkEmail_GetReport $index $outStr]
set retStr [CkEmail_getReport $myEmail $index]

(See the NumReports property.) Returns the body content of the Nth report within a multipart/report email.

Multipart/report is a message type that contains data formatted for a mail server to read. It is split between a text/plain (or some other content/type easily readable) and a message/delivery-status, which contains the data formatted for the mail server to read.

It is defined in RFC 3462

Returns 1 for success, 0 for failure.

top
GetSignedByCert
# returns a CkCert
set ret_cert [CkEmail_GetSignedByCert]

Return the certificate used to digitally sign this email.

Returns NULL on failure

More Information and Examples
top
GetSignedByCertChain
# returns a CkCertChain
set ret_certChain [CkEmail_GetSignedByCertChain]
Introduced in version 9.5.0.40

Return the full certificate chain of the certificate used to digitally sign this email.

Returns NULL on failure

top
GetSigningCert
# returns a CkCert
set ret_cert [CkEmail_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.

Returns NULL on failure

top
GetTo
# index is an integer
# outStr is a CkString (output)
set status [CkEmail_GetTo $index $outStr]
set retStr [CkEmail_getTo $myEmail $index]

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

Returns 1 for success, 0 for failure.

More Information and Examples
top
GetToAddr
# index is an integer
# outStr is a CkString (output)
set status [CkEmail_GetToAddr $index $outStr]
set retStr [CkEmail_getToAddr $myEmail $index]

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

Returns 1 for success, 0 for failure.

top
GetToName
# index is an integer
# outStr is a CkString (output)
set status [CkEmail_GetToName $index $outStr]
set retStr [CkEmail_getToName $myEmail $index]

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

Returns 1 for success, 0 for failure.

top
GetXml
# outStrXml is a CkString (output)
set status [CkEmail_GetXml $outStr]
set retStr [CkEmail_getXml $myEmail]

Convert the email object to an XML document in memory

Returns 1 for success, 0 for failure.

top
HasHeaderMatching
# fieldName is a string
# valuePattern is a string
# caseSensitive is a boolean
set retBool [CkEmail_HasHeaderMatching $fieldName $valuePattern $caseSensitive]

Returns 1 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.

top
HasHtmlBody
set retBool [CkEmail_HasHtmlBody]

Returns true if the email has an HTML body.

top
HasPlainTextBody
set retBool [CkEmail_HasPlainTextBody]

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

top
IsMultipartReport
set retBool [CkEmail_IsMultipartReport]

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

top
LoadEml
# mimePath is a string
set status [CkEmail_LoadEml $mimePath]

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

Note: This replaces the entire contents of the email object, including the To/CC recipients.

Returns 1 for success, 0 for failure.

top
LoadTaskResult
# task is a CkTask
set status [CkEmail_LoadTaskResult $task]
Introduced in version 9.5.0.52

Loads the email object from a completed asynchronous task.

Returns 1 for success, 0 for failure.

More Information and Examples
top
LoadXml
# xmlPath is a string
set status [CkEmail_LoadXml $xmlPath]

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

Note: This replaces the entire contents of the email object, including the To/CC recipients.

Returns 1 for success, 0 for failure.

top
LoadXmlString
# xmlStr is a string
set status [CkEmail_LoadXmlString $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 1 for success, 0 for failure.

top
QEncodeBytes
# inData is a CkByteData
# charset is a string
# outEncodedStr is a CkString (output)
set status [CkEmail_QEncodeBytes $inData $charset $outStr]
set retStr [CkEmail_qEncodeBytes $myEmail $inData $charset]

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

Returns 1 for success, 0 for failure.

top
QEncodeString
# str is a string
# charset is a string
# outEncodedStr is a CkString (output)
set status [CkEmail_QEncodeString $str $charset $outStr]
set retStr [CkEmail_qEncodeString $myEmail $str $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.

Returns 1 for success, 0 for failure.

top
RemoveAttachedMessage
# idx is an integer
CkEmail_RemoveAttachedMessage $idx

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

top
RemoveAttachedMessages
CkEmail_RemoveAttachedMessages

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

top
RemoveAttachmentPaths
CkEmail_RemoveAttachmentPaths

Removes path information from all attachment filenames.

top
RemoveHeaderField
# fieldName is a string
CkEmail_RemoveHeaderField $fieldName

Removes by name all occurrences of a header field.

top
RemoveHtmlAlternative
CkEmail_RemoveHtmlAlternative

Removes the HTML body from the email (if an HTML body exists).

top
RemovePlainTextAlternative
CkEmail_RemovePlainTextAlternative

Removes the plain-text body from the email (if a plain-text body exists).

top
SaveAllAttachments
# dirPath is a string
set status [CkEmail_SaveAllAttachments $dirPath]

Save all the attachments of an email to files in a directory specified by dirPath. The OverwriteExisting property controls whether existing files are allowed to be overwritten.

Note: Email attachment filenames can be renamed or modified prior to saving. The number of attachments is available in the NumAttachments property. An application can loop over the attachments to get the filename for each by calling GetAttachmentFilename(index). Each attachment's filename can be set by calling SetAttachmentFilename(index, newFilename).

Returns 1 for success, 0 for failure.

top
SaveAttachedFile
# index is an integer
# dirPath is a string
set status [CkEmail_SaveAttachedFile $index $dirPath]

Saves the Nth email attachment to the directory specified by dirPath. The 1st attachment is at index 0. The OverwriteExisting property controls whether existing files are allowed to be overwritten.

Returns 1 for success, 0 for failure.

top
SaveEml
# emlFilePath is a string
set status [CkEmail_SaveEml $emlFilePath]

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

Returns 1 for success, 0 for failure.

top
SaveRelatedItem
# index is an integer
# dirPath is a string
set status [CkEmail_SaveRelatedItem $index $dirPath]

Saves the Nth related item to the directory specified by dirPath. (The 1st related item is at index 0) Related content items are typically image or style-sheets embedded within an HTML email. The OverwriteExisting property controls whether existing files are allowed to be overwritten.

Returns 1 for success, 0 for failure.

top
SaveXml
# path is a string
set status [CkEmail_SaveXml $path]

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

Returns 1 for success, 0 for failure.

top
SetAttachmentCharset
# index is an integer
# charset is a string
set status [CkEmail_SetAttachmentCharset $index $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.

Returns 1 for success, 0 for failure.

top
SetAttachmentDisposition
# index is an integer
# disposition is a string
set status [CkEmail_SetAttachmentDisposition $index $disposition]

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 index 0.

Returns 1 for success, 0 for failure.

top
SetAttachmentFilename
# index is an integer
# filename is a string
set status [CkEmail_SetAttachmentFilename $index $filename]

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

Returns 1 for success, 0 for failure.

More Information and Examples
top
SetBinaryBody
# byteData is a CkByteData
# contentType is a string
# disposition is a string
# filename is a string
set status [CkEmail_SetBinaryBody $byteData $contentType $disposition $filename]
Introduced in version 9.5.0.44

Sets the main body of the email to binary content of any type. The disposition can be an empty string, "inline", or "attachment". If a filename is specified, the disposition must be non-empty because the filename is an attribute of the content-disposition header field.

Returns 1 for success, 0 for failure.

top
SetDecryptCert
# cert is a CkCert
set status [CkEmail_SetDecryptCert $cert]
Introduced in version 9.5.0.57

Allows for a certificate to be explicity provided for decryption. When an email object is loaded via any method, such as LoadEml, SetFromMimeText, SetFromMimeBytes, etc., security layers (signatures and encryption) are automatically unwrapped. This method could be called prior to calling a method that loads the email.

Returns 1 for success, 0 for failure.

top
SetDecryptCert2
# cert is a CkCert
# key is a CkPrivateKey
set status [CkEmail_SetDecryptCert2 $cert $key]
Introduced in version 9.5.0.57

Allows for a certificate and private key to be explicity specified for decryption. When an email object is loaded via any method, such as LoadEml, SetFromMimeText, SetFromMimeBytes, etc., security layers (signatures and encryption) are automatically unwrapped. Decryption requires a private key. On Windows-based systems, the private key is often pre-installed and nothing need be done to provide it because Chilkat will automatically find it and use it. However, if not on a Windows system, or if the private key was not pre-installed, then it can be provided by this method, or via the AddPfxSourceFile / AddPfxSourceData methods.

Returns 1 for success, 0 for failure.

More Information and Examples
top
SetDt
# dt is a CkDateTime
set status [CkEmail_SetDt $dt]

Sets the "Date" header field of the email to have the value of the date/time object provided.

Returns 1 for success, 0 for failure.

top
SetEdifactBody
# message is a string
# name is a string
# filename is a string
# charset is a string
CkEmail_SetEdifactBody $message $name $filename $charset
Introduced in version 9.5.0.28

Creates a typical email used to send EDIFACT messages. Does the following:

  1. Sets the email body to the EDIFACT message passed in message.
  2. Sets the Content-Transfer-Encoding to Base64.
  3. Set the Content-Type equal to "application/EDIFACT".
  4. Sets the Content-Type header's name attribute to name.
  5. Sets the Content-Disposition equal to "attachment".
  6. Sets the Content-Disposition's "filename" attribute equal to filename.
  7. The EDIFACT message is converted to the charset indicated by charset, and encoded using Base64 in the email body.
The email's subject, recipients, FROM address, and other headers are left unmodified.

top
SetEncryptCert
# cert is a CkCert
set status [CkEmail_SetEncryptCert $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.

Returns 1 for success, 0 for failure.

top
SetFromMimeBd
# bindat is a CkBinData
set status [CkEmail_SetFromMimeBd $bindat]
Introduced in version 9.5.0.62

Loads an email with the MIME stored in a BinData object.

Note: This replaces the entire contents of the email object, including the To/CC recipients.

Returns 1 for success, 0 for failure.

top
SetFromMimeBytes
# mimeBytes is a CkByteData
set status [CkEmail_SetFromMimeBytes $mimeBytes]

Loads the email object with the mimeBytes. If the email object already contained an email, it is entirely replaced. The character encoding (such as "utf-8", "iso-8859-1", etc.) of the bytes is automatically inferred from the content. If for some reason it is not possible to determine the character encoding, the SetFromMimeBytes2 method may be called to explicitly specify the charset.

Returns 1 for success, 0 for failure.

top
SetFromMimeBytes2
# mimeBytes is a CkByteData
# charset is a string
set status [CkEmail_SetFromMimeBytes2 $mimeBytes $charset]

Loads the email object with the mimeBytes. If the email object already contained an email, it is entirely replaced.

The charset specifies the character encoding of the MIME bytes (such as "utf-8", "iso-8859-1", etc.).

Returns 1 for success, 0 for failure.

top
SetFromMimeSb
# sb is a CkStringBuilder
set status [CkEmail_SetFromMimeSb $sb]
Introduced in version 9.5.0.62

Loads an email with the MIME stored in a StringBuilder object.

Note: This replaces the entire contents of the email object, including the To/CC recipients.

Returns 1 for success, 0 for failure.

top
SetFromMimeText
# mimeText is a string
set status [CkEmail_SetFromMimeText $mimeText]

Loads an email with the contents of a .eml (i.e. MIME) contained in a string.

Note: This replaces the entire contents of the email object, including the To/CC recipients.

Returns 1 for success, 0 for failure.

top
SetFromXmlText
# xmlStr is a string
set status [CkEmail_SetFromXmlText $xmlStr]

Loads an email from an XML string.

Note: This replaces the entire contents of the email object, including the To/CC recipients.

Returns 1 for success, 0 for failure.

top
SetHtmlBody
# html is a string
CkEmail_SetHtmlBody $html

Sets the HTML body of an email.

More Information and Examples
top
SetMbHtmlBody
# charset is a string
# inData is a CkByteData
set status [CkEmail_SetMbHtmlBody $charset $inData]

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.

Returns 1 for success, 0 for failure.

top
SetMbPlainTextBody
# charset is a string
# inData is a CkByteData
set status [CkEmail_SetMbPlainTextBody $charset $inData]

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.

Returns 1 for success, 0 for failure.

top
SetRelatedFilename
# index is an integer
# path is a string
set status [CkEmail_SetRelatedFilename $index $path]

Sets the filename for a related item within the email.

Returns 1 for success, 0 for failure.

top
SetReplacePattern
# pattern is a string
# replaceString is a string
set status [CkEmail_SetReplacePattern $pattern $replaceString]

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

Returns 1 for success, 0 for failure.

More Information and Examples
top
SetSigningCert
# cert is a CkCert
set status [CkEmail_SetSigningCert $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.

Returns 1 for success, 0 for failure.

More Information and Examples
top
SetSigningCert2
# cert is a CkCert
# key is a CkPrivateKey
set status [CkEmail_SetSigningCert2 $cert $key]

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 1 for success, 0 for failure.

top
SetTextBody
# bodyText is a string
# contentType is a string
CkEmail_SetTextBody $bodyText $contentType

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.

More Information and Examples
top
UidlEquals
# e is a CkEmail
set retBool [CkEmail_UidlEquals $e]

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

top
UnpackHtml
# unpackDir is a string
# htmlFilename is a string
# partsSubdir is a string
set status [CkEmail_UnpackHtml $unpackDir $htmlFilename $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.

The unpackDir is the absolute or relative directory path where the HTML file should be written. The partsSubdir is the subdirectory beneath unpackDir where images and style sheets should be written. If partsSubdir does not already exist, it is automatically created.

For example, if unpackDir = "C:/test", htmlFilename = "myEmail.html", and partsSubdir = "images", then C:/test/myEmail.html is created, and the related files are written into C:/test/images.

Note: The UnpackHtml method extracts images that are actually contained within the email itself. If the HTML contains an "IMG" tag that just links to an image on the web (but the image data is not contained locally within the email), then the image is not unpacked (because it would need to be downloaded from the web).

Returns 1 for success, 0 for failure.

More Information and Examples
top
UnSpamify
CkEmail_UnSpamify

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

top
UnzipAttachments
set status [CkEmail_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.

Returns 1 for success, 0 for failure.

top
UseCertVault
# vault is a CkXmlCertVault
set status [CkEmail_UseCertVault $vault]
Introduced in version 9.5.0.40

Adds an XML certificate vault to the object's internal list of sources to be searched for certificates and private keys when encrypting/decrypting or signing/verifying. Unlike the AddPfxSourceData and AddPfxSourceFile methods, only a single XML certificate vault can be used. If UseCertVault is called multiple times, only the last certificate vault will be used, as each call to UseCertVault will replace the certificate vault provided in previous calls.

Returns 1 for success, 0 for failure.

top
ZipAttachments
# zipFilename is a string
set status [CkEmail_ZipAttachments $zipFilename]

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

Returns 1 for success, 0 for failure.

top