A guide to all of the methods that ASPMail provides on our NT Servers.

SendMail

The SendMail method attempts to send the email. SendMail takes no parameters, you build the message using the FromAddress, Subject, BodyText, and RemoteHost properties along with the AddRecipient method.

Returns: True / False

Example:

if Mailer.SendMail then
	' Message sent Successfully
else
	Response.Write ("Mail Failure: " & Mailer.Response)
end if

Back to top

AddRecipient (name, address)

Adds a new recipient, as shown in the message's To list. 'Name' may be left blank.

Returns: True / False

Example:

returnValue = Mailer.AddRecipient("Jay Jones","jayj@somehost.net")
if returnValue then
	' jay jones added successfully
end if

Back to top

ClearRecipients

Clears any recipients assigned to the To list.

Returns: Nothing

Back to top

AddCC (name, address)

Adds a new recipient, as shown in the message's CC list. The 'name' parameter may be left blank.

Returns: True / False

Example:

returnValue = Mailer.AddCC ("", "jayj@somehost.net")
if returnValue then
	' jayj added successfully
end if

Back to top

ClearCCs

Clears any recipients assigned to the CC list.

Returns: Nothing

Back to top

AddBCC (name, address)

Adds a new Blind Carbon Copy recipient. BCC recipients are not shown in any message recipient list.

Returns: True / False

Example:

returnValue = Mailer.AddBCC ("Jay Jones", "jayj@somehost.net")
if returnValue then
	' Jay Jones added to BCC list
end if

Back to top

ClearBCCs

Clears any recipients assigned to the BCC list.

Returns: Nothing

Back to top

ClearAllRecipients

Clears all recipients assigned to the To, CC and BCC lists.

Returns: Nothing

Back to top

AddAttachment (filePath)

Adds attachments to current mailing. You must use a fully qualified path to attach files.

Returns: Nothing

Examples:

Mailer.AddAttachment ("D:\webs\mysite\downloads\myfile.zip")

Mailer.AddAttachment (Server.Mappath("/downloads/myFile.zip"))

Back to top

ClearAttachments

Clears any attachments that were previously set.

Returns: Nothing

Back to top

ClearBodyText

Clears any text assigned to the message's body which may have been set previously by using the BodyText property.

Returns: Nothing

Back to top

AddExtraHeader (header)

Adds extra X-Headers to the mail envelope. 'Header' is a string value that forms a proper SMTP X-Header.

Returns: True / False

Example:

returnValue = Mailer.AddExtraHeader("X-HeaderName: XHdrValue")

Back to top

ClearExtraHeaders

Clears any X-Headers that were set by use of AddExtraHeader.

Back to top

GetBodyTextFromFile (filePath)

Loads message's body text from a file. filePath must be a fully qualified path.

Examples:

Mailer.GetBodyTextFromFile ("d:\webs\mysite\data\msgbody.txt")

Mailer.GetBodyTextFromFile (Server.MapPath("/data/msgbody.txt")

Back to top

EncodeHeader (strValue)

Encodes a string in RFC1522 format to provide support for 8bit mail headers such as 8bit subject headers. 'strValue' is the string to encode.

Returns: Encoded string

Example:

Mailer.Subject = Mailer.EncodeHeader("Résponse de Service à la clientèle")

Back to top

GetTempPath

Returns the path set up by the OS for temporary mail files.

Returns: Path string

Example:

tempPath = Mailer.GetTempPath

Back to top

Please note: the information on this page applies to ITS web hosting plans. It may or may not apply to other environments. If you are looking for a feature described here, or better support from your hosting provider, please consider hosting your site with ITS!

1555 N Naperville/Wheaton Road, Suite 107
Naperville, IL 60563
phone 630.420.2550
fax 630.420.2771