ASPMail Methods

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

SendMail AddCC
AddRecipient ClearCCs
ClearRecipients AddBCC
ClearAllRecipients ClearBCCs
AddAttachment GetBodyTextFromFile
ClearAttachments ClearBodyText
AddExtraHeader EncodeHeader
ClearExtraHeaders GetTempPath

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, EraseFile (boolean), ShowWindow (boolean))

Returns: True / False

Loads message's body text from a file. filePath must be a fully qualified path. If EraseFile is true then the file is erased once the file is loaded.
ShowWindow should always be set to false on our platform.

Note: In order for the EraseFile option to work successfully, the file muse be located in the /data directory of the site and must have been created
programtically in the anonymous user contect (i.e. created via an Acitve Server Page).

Examples:
Mailer.GetBodyTextFromFile "d:\webs\mysite\data\msgbody.txt", False, False
Mailer.GetBodyTextFromFile Server.MapPath("/data/msgbody.txt"), True, False

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