A guide to all of the methods that ASPMail provides on our NT Servers.
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
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
Clears any recipients assigned to the To list.
Returns: Nothing
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
Clears any recipients assigned to the CC list.
Returns: Nothing
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
Clears any recipients assigned to the BCC list.
Returns: Nothing
Clears all recipients assigned to the To, CC and BCC lists.
Returns: Nothing
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"))
Clears any attachments that were previously set.
Returns: Nothing
Clears any text assigned to the message’s body which may have been set previously by using the BodyText property.
Returns: Nothing
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")
Clears any X-Headers that were set by use of AddExtraHeader.
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
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")
Returns the path set up by the OS for temporary mail files.
Returns: Path string
Example:
tempPath = Mailer.GetTempPath