1. Introduction
2. Getting Started
3. Attachments
4. Embedded Images
5. Security
6. Unicode
7. Queuing Part I
8. Queuing Part II
Object Reference





Newsletter Signup
File Upload Component
Encryption and Secure Mail Component
Data-bound Editable Grid Component

Chapter 8: Message Queuing. Part II Object Reference

MailSender Object
Persits.MailSender Properties Persits.MailSender Methods
AltBody
Body
CharSet
ContentTransferEncoding
Expires
From
FromName
Helo
Host
IsHTML
MailFrom
Password
Port
Priority
Queue
QueueFileName
Subject
Timeout
Timestamp
Username
AddAddress
AddAttachment
AddAttachmentMem
AddBcc
AddCC
AddCustomHeader
AddEmbeddedImage
AddEmbeddedImageMem
AddReplyTo
AppendBodyFromFile
EncodeHeader
LogonUser
Reset
ResetAll
RevertToSelf
Send
SendEncrypted
SendSigned
SendSignedAndEncrypted
SendToNewsgroup
SendToQueue

MailLogger Object
Persits.MailLogger Properties Persits.MailLogger Methods
Records
Clear
Close
Open
Refresh

LogEntry Object
LogEntry Properties LogEntry Methods
DateTime
FileName
Recipient
Status
Text
 

Persits.MailSender Properties
AltBody As String (Read/Write)
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.
Body As String (Read/Write)
Specifies a message body. Can be in a text or HTML format. In the latter case, the IsHTML property must be set to True.
CharSet As String (Read/Write)
"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.
ContentTransferEncoding As String (Read/Write)
"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.
Expires As Date (Read-Only)
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.
From As String (Read/Write)
Specifies the sender's email address. This property is required.
FromName As String (Read/Write)
Specifies the sender's name.
Helo As String (Read/Write)
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.
Host As String (Read/Write)
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.
IsHTML As Boolean (Read/Write)
False by default. Must be set to True if the body is in the HTML format.
MailFrom As String (Read/Write)
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.
Password As String (Read/Write)
See comments to the property Username. This is a premium feature.
Port As Integer (Read/Write)
Specifies the SMTP port number. 25 by default.
Priority As Integer (Read/Write)
Specifies message priority. Valid values are 1 (high), 3 (normal) and 5 (low). 0 by default which means priority is not specified.
Queue As Boolean (Read/Write)
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.
QueueFileName As String (Read-Only)
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.
Subject As String (Read/Write)
Specifies the message subject.
Timeout As Integer (Read/Write)
Specifies socket timeout (in millisecond).
Timestamp As Date (Read/Write)
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.
Username As String (Read/Write)
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.
Persits.MailSender Methods
Sub AddAddress(Address As String, Optional Name = "")
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.
Sub AddAttachment(Path As String)
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.
Sub AddAttachmentMem(Name As String, Blob As Variant)
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.
Sub AddBcc(Address As String, Optional Name = "")
Adds an email address to the message's BCC: (blind carbon copy) list. This method can be called multiple times per message.
Sub AddCC(Address As String, Optional Name = "")
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.
Sub AddCustomHeader(Header As String)
Adds a custom header to the message, e.g. mail.AddCustomHeader "Return-Receipt-To: <name@domain.com>"
Sub AddEmbeddedImage(Path As String, ContentID As String)
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
Sub AddEmbeddedImageMem(Name As String, ContentID As String, Blob As Variant)
Same as AddEmbeddedImage but adds an image from memory rather than disk. This is a premium feature.
Sub AddReplyTo(Address As String, Optional Name)
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.
Sub AppendBodyFromFile(Path As String, Optional AddToBody = True)
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. This is a premium feature.
Function EncodeHeader(Header As String, Optional Charset = "ISO-8859-1") As String
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.

Sub LogonUser(Domain As String, Username As String, Password As String, Optional Flags = 2)
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.

Sub Reset()
Clears all address and attachment lists so that a new message can be sent.
Sub ResetAll()
Same as Reset plus resets all properties to their respective default values.
Sub RevertToSelf()
Ends impersonation begun by LogonUser.
Function Send(Optional Path = "") As Boolean
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.
Sub SendEncrypted(Msg As CryptoMessage)
Sends an encrypted message. Msg is an object creatable by the AspEncrypt component. See AspEncrypt Web site for more information.
Sub SendSigned(Msg As CryptoMessage)
Sends a digitally signed message. Msg is an object creatable by the AspEncrypt component. See AspEncrypt Web site for more information.
Sub SendSignedAndEncrypted(Msg1 As CryptoMessage, Msg2 As CryptoMessage)
Sends a message which is first digitally signed and then encrypted. See AspEncrypt Web site for more information.
Sub SendToNewsgroup(Newsgroup As String)
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.
Sub SendToQueue(Optional Path = "")
Equivalent to calling Mail.Queue = True followed by Mail.Send. Obsolete, supported for backwards compatibility only.
Persits.MailLogger Properties
Records As Object (Read-Only)
Returns the collection of LogEntry objects each representing an individual log entry.
Persits.MailLogger Methods
Sub Clear()
Clears the log file. All records in the log are erased.
Sub Close()
Closes the log opened via the Open method.
Sub Open(Optional Path = "")
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.
Sub Refresh(Optional Path = "")
Re-populates the Records collection with the latest data.
LogEntry Properties
DateTime As Date (Read-Only)
Returns the timestamp information for the log entry.
FileName As String (Read-Only)
Returns the filename of the message file responsible for this entry.
Recipient As String (Read-Only)
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.
Status As String (Read-Only)
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.

Text As String (Read-Only)
Returns the entire log entry.

Chapter 8: Message Queuing. Part II  


Copyright © 1999 - 2003 Persits Software, Inc.
All Rights Reserved
Questions? Comments? Write us!