ASPMail Methods


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]


AddRecipient (name, address)

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

Example:
     returnValue = Mailer.AddRecipient("Joan Jones", "joanj@somehost.net")
     if returnValue then
          ' joan jones added successfully
     end if

back]


ClearRecipients

Clears any recipients assigned to the To list.
Returns: Nothing

back]


ClearAllRecipients

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

back]


AddAttachment (filePath)

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

Example:
     Mailer.AddAttachment ("D:\webs\mysite\downloads\myfile.zip")
     Mailer.AddAttachment (Server.Mappath("/downloads/myFile.zip"))

back]


ClearAttachments

Clears any attachments that were previously set.
Returns: Nothing

back]


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]


ClearExtraHeaders

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

back]


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 ("", "joanj@somehost.net")
     if returnValue then
          ' jayj added successfully
     end if

back]


ClearCCs

Clears any recipients assigned to the CC list.
Returns: Nothing

back]


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 ("Joan Jones", "joan@somehost.net")
     if returnValue then
          ' Joan Jones added to BCC list
     end if

back]


ClearBCCs

Clears any recipients assigned to the BCC list.
Returns: Nothing

back]


GetBodyTextFromFile

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

Example:
     Mailer.GetBodyTextFromFile ("d:\webs\mysite\data\msgbody.txt")
     Mailer.GetBodyTextFromFile (Server.MapPath("/data/msgbody.txt")

back]


ClearBodyText

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

back]


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]


GetTempPath

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

Example:
     tempPath = Mailer.GetTempPath

back]