AspEmail Object Reference
MailSender Member List
MailLogger Member List
LogEntry Member List
MailSender Properties
Specifies an alternative text version of a message while Body specifies an HTML version. When this property is set, AspEmail generates a "multipart/alternative" message to support email clients that are not HTML-enabled. Side effect: when this property is set, IsHTML property gets set to True. This is a premium feature.
Specifies a message body. Can be in a text or HTML format. In the latter case, the IsHTML property must be set to True.
"ISO-8859-1" by default. Specifies the charset part of the Content-Type MIME header. Setting this property to a non-default value causes AspEmail to perform a conversion of message body characters into the specified character set. If this property it set to "UTF-8", AspEmail uses the UTF-8 encoding. To learn more, and for a list of valid values for this property, see Chapter 6. This is a premium feature.
"7bit" by default. Specifies the Content-Transfer-Encoding MIME header for the message body. Other valid values include "8bit" and "quoted-printable". If you set this property to "quoted-printable" AspEmail will automatically convert the message body to the Quoted-Printable format as specified in RFC-2045. You should always set this property to "quoted-printable" if you set CharSet to "UTF-8". This is a premium feature.
Returns the expiration date of the component's premium features. Returns 9/9/9999 if a valid registration key is installed. Returns 0 (displayed as "12:00 AM") if the expiration value in the registry is corrupt or missing.
Specifies the sender's email address. This property is required.
Specifies the sender's name.
This string is sent with the HELO command (or EHLO if Username property is set) when an SMTP session begins. Used by an SMTP client to identify its domain name to the SMTP server. By default, AspEmail uses a value returned by the GetComputerNameEx Win32 API.
The internet address of an SMTP host to be used to send email. This property is required, unless message queuing is used and a host is specified via the EmailAgent configuration panel.
False by default. Must be set to True if the body is in the HTML format.
Specifies an email address for the Return-Path: header. Useful for bounced-mail handling purposes. If this property is not specified, the From value is used for this header.
See comments to the property Username. This is a premium feature.
Specifies the SMTP port number. 25 by default.
Specifies message priority. Valid values are 1 (high), 3 (normal) and 5 (low). 0 by default which means priority is not specified.
Enables message queuing. False by default. If set to True, specifies that a subsequent call to Send will place the message in a message queue to be processed by EmailAgent. This is a premium feature.
Returns the name of a message file generated by a call to Mail.Queue = True followed by Mail.Send. Do NOT use this property to specify a file attachments, use the AddAttachment method instead.
Specifies the registration key. If this property is not set, AspEmail will look for a registration key in the system registry under HKLM\Software\Persits Software\AspEmail\RegKey.
Enables the Secure Socket Layer (SSL) protocol. If set to True, the Port property must also be set to 465. This property was added in Version 5.4. This is a premium feature.
Specifies the message subject.
Specifies socket timeout (in millisecond).
Used for deferred message processing. Specifies when the message is to be sent out from the queue by EmailAgent. This property is only used when Queue is set to True, and ignored when it is False.
Enables the Transport Layer Security (TLS) protocol. Should be set to True when the SMTP server pointed to by Mail.Host requires TLS. This property was added in Version 5.1. This is a premium feature.
Specifies the version of the TLS protocol. "1.2" by default. Set this property to "1.0" to force AspEmail to use TLS 1.0. This property was added in Version 5.5.
Used for SMTP authentication together with Password. Use the Username/Password properties if your SMTP server requires a mail client to supply authentication parameters. AspEmail supports AUTH=LOGIN, CRAM-MD5 and NTLM authentication methods. This is a premium feature.
Returns a string representing the current component version, e.g. "5.6.0.0".
MailSender Methods
Adds an email address and optionally the corresponding full name to the message's To: list. This method can be called multiple times per message.
Adds a multipart/alternative version of the body to the message. This method is useful for generating email messages with advanced content, such as accelerated mobile pages (AMP), calendar invitations, etc.
Body specifies the content of the body subsection.
ContentType specifies the content-type header for this subsection of the message body, such as "text/html", "text/calendar", etc.
This method was introduced in Version 5.6. See Section 2.5 - Extended Multipart/Alternative Support for more information.
This is a premium feature.
Adds a file to the list of file attachments to be sent with the message. A full physical path must be specified. This method can be called multiple times per message.
Attaches a memory file. Name specifies the file name, Blob is a memory binary array. A typical 2nd argument would be a recordset value containing a file blob, or an expression such as File.Binary where File is an AspUpload file object. See Chapter 3 for more info.
Adds an email address to the message's BCC: (blind carbon copy) list. This method can be called multiple times per message.
Adds an email address and optionally the corresponding full name to the message's CC: (carbon copy) list. This method can be called multiple times per message.
Adds a custom header to the message, e.g. mail.AddCustomHeader "Return-Receipt-To: <name@domain.com>"
Starting with Version 5.0.0.5, you can use this method to specify a custom Message ID for your message, e.g.
Mail.AddCustomHeader "Message-ID: abc12356"
Adds an image file to the list of images embedded in the message body. ContentID is a string without spaces, such as "My-Image", which will be referenced by the body HTML in the following way: <IMG SRC="cid:My-Image"> or <BODY BACKGROUND="cid:My-Image">. See Chapter 4 for more info. This is a premium feature
Same as AddEmbeddedImage but adds an image from memory rather than disk. This is a premium feature.
Adds an email address and optionally the corresponding full name to the message's Reply-To: list. This method can be called multiple times per message.
Appends the Body property from a text or HTML file specified by Path (if the AddToBody flag is set to True or omitted.) If AddToBody is set to False, the content of the file is appended to AltBody instead.
Starting with Version 5.0.0.5, this method supports text files in Unicode format (both little-endian and big-endian.)
As of Version 5.6, this method can be used to append to an arbitrary multipart/alternative sub-section of the message body by setting AddToBody to a string content-type value, such as "text/html", "text/plain", "text/calendar", etc.
This is a premium feature.
Encodes a string containing non-US-ASCII characters according to RFC-1522, returns the resultant encoded string. Use this method to encode a non-US-ASCII subject, sender's name or recipient's name, e.g.
Mail.Subject = Mail.EncodeHeader("La fête à Jean-Sébastien Bach")
or
Mail.AddAddress "oystein@somecompany.no", Mail.EncodeHeader("Øystein")
Charset can be set to "UTF-8" or any valid character set code described in Chapter 6.
Obtains the oAuth access token, refresh token (if applicable) and expiration information from an oAuth authorization code or previously obtained refresh token. Returns a new instance of the MailSender object with the Username property set to the access token, Password to refresh token, and Timeout to expiration information in seconds.
Service specifies the name of the oAuth service. Currently, the only supported service is "GMAIL".
Code specifies either the oAuth authorization code, or previously obtained refresh token.
Refresh is a flag indicating what value Code represents: an authorization code (if set to True) or refresh token (if set to False).
This method was introduced in version 5.5.0.1.
For more information, see Section 5.6 - Google GMAIL oAuth Support.
Retrieves a specific multipart/alternative version of the message body identified by its content type. This method can be used in conjunction with AddAltBody.
ContentType specifies the content-type of the body sub-section to be retrieved. Can be set to "text/plain", "text/calendar", etc.
This method was introduced in Version 5.6. See Section 2.5 - Extended Multipart/Alternative Support for more information.
Impersonates the specified user account. If Domain is empty, the local computer will be used to validate the Username/Password. The caller must have the "Act as Part of the Operating System" privilege, otherwise the error "A required privilege is not held by client" error will be thrown.
This method is useful when using message queuing (Mail.Queue = True) if the message queue is located on another machine and the current user account's credentials are insufficient to place a message in a remote queue.
The Flags argument should not normally be used.
Clears all address, attachment and custom header lists so that a new message can be sent.
Clears all address lists so that a new message can be sent. Does not clear attachments, embedded images, custom headers or properties.
Introduced in Version 5.2.
Same as Reset plus resets all properties to their respective default values.
Ends impersonation begun by LogonUser.
Sends a message. Returns True if successful, False otherwise. Throws exceptions in case of an error. If Mail.Queue is set to True, the message is not sent directly to the SMTP server but placed in the message queue for further processing by EmailAgent. The name of the message file thus created can be retrieved via the property QueueFileName. Path specifies the message queue location. If this argument is omitted, the default message queue location is used. In case message queuing is not used, Path is ignored.
Sends a message equipped with a DKIM signature.
- Cert is the signer certificate creatable by the AspEncrypt component.
- Domain and Selector are the email domain and selector to be used for signature verification.
- Options is a collection of flags and should normally be 0. Bit 1, if set, prevents the Date header from being included in the signature, Bit 2, if set, prevents the Message-ID header from being included in the signature. As of Version 5.6.0.4, Bits 3, 4 and 5 prevent the custom headers List-Unsubscribe, List-Unsubscribe-Post, and Feedback-ID, respectively, from being included in the signature.
- Path specifies the message queue location. If this argument is omitted, the default message queue location is used. In case message queuing is not used, Path is ignored.
Before this method is called, the property ContentTransferEncoding must be set to "Quoted-Printable".
See Section 5.5 of the user manual for more information.
Introduced in Version 5.3.
This is a premium feature.
Sends an encrypted message. Msg is an object creatable by the AspEncrypt component. See AspEncrypt Web site for more information.
Sends a digitally signed message. Msg is an object creatable by the AspEncrypt component. See AspEncrypt Web site for more information.
Sends a message which is first digitally signed and then encrypted. See AspEncrypt Web site for more information.
Posts a message (article) to a news group specified by Newsgroup via the NNTP protocol. This method ignores addresses specified by AddAddress, etc. methods. Host must point to a valid NNTP server. Uses port 119 by default, unless the Port property is set to anything other than the default (25), in which case it uses a value specified by Port. This is a premium feature.
Equivalent to calling Mail.Queue = True followed by Mail.Send. Obsolete, supported for backwards compatibility only.
Performs the syntactic validation of the specified email Address. Call this method on a user-specified address to make sure its syntax is valid. This method does NOT determine if an email address actually exists. Returns the following values:
0 - Valid address
1 - Too short
2 - Too long (greater than 256 chars)
3 - No @ character
4 - Nothing before @
5 - Characters before @ must be a-z A-Z 0-9 ' _ . - +
6 - No dots after @
7 - Zero-length subdomain
8 - Characters in a subdomain must be a-z A-Z 0-9 -
9 - Characters in a top-level subdomain must be a-z A-Z 0-9
10 - Top-level subdomain must be at least 2 characters long
11 - Name part of address cannot start or end with a dot
12 - A subdomain cannot start or end with a dash (added in Version 5.4.0.6)
See Section 2.4 for more info.
Determines whether Address exists via a DNS lookup of the MX records of the address's domain and connecting to the corresponding SMTP server. Returns an empty string if the address is believed to exist, and an error message otherwise. Uses DNS as the address of the DNS server for the MX record lookup. If this argument is omitted, obtains the local DNS addresses from the system registry.
See Section 2.4 for more info.
MailLogger Properties
Returns the collection of LogEntry objects each representing an individual log entry.
MailLogger Methods
Clears the log file. All records in the log are erased.
Closes the log opened via the Open method.
Opens the log, populates the Records collection. If Path is specified, opens the file specified by Path. If this argument is omitted, opens the default log file specified in the EmailAgent configuration panel.
Re-populates the Records collection with the latest data.
LogEntry Properties
Returns the timestamp information for the log entry.
Returns the filename of the message file responsible for this entry.
Returns the recipient's email address for the log entry. This information is particularly useful for bounced-message handling purposes. See Chapter 8 for more info.
Returns the following strings:
"SUCCESS" - for a successful SMTP send.
"FAILURE" - for a non-fatal send. The message will be resent.
"ERROR" - for a fatal send. The message was moved to the \Failed folder and will not be resent.
"SYSTEM" - for a system error, such as failure to connect to the POP3 server, etc. Such entries are not associated with any particular message.
"RECEIVED" - for a successful POP3 message retrieval.
Returns the entire log entry.