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
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
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
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.
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")
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
ASPMail Properties
A guide to all of the properties that ASPMail provides on our NT Servers.
The message body text. To clear the text once you have set it use the ClearBodyText Method.
Example:
Mailer.BodyText = "Your order for 15 widgets has been processed"
The character set. By default the char set is US Ascii
Valid values:
-
1 = US Ascii
-
2 = ISO-8859-1
Example:
Mailer.CharSet = 2
The ConfirmReading flag. If this is set to true AND the recipients email program supports
this feature (and it is enabled) the recipients email program will send a notice back to the FromAddress confirming that this email has been read.
Example:
Mailer.ConfirmRead = true
The ContentType property allows you to set the ContentType header of the message's BodyText. If, for example, you wanted to send HTML as the messages's body, you could set ContentType = "text/html" and EMail programs that support HTML content could properly display the HTML text.
Note: The ContentType property is ignored if you have file attachments.
Example:
Mailer.ContentType = "text/html"
If you wish to use a character set besides the included types you can set CustomCharSet to a character set string.
Example:
Mailer.CustomCharSet = "ISO-2022" or
Mailer.CustomCharSet = "big5"
AspMail will, by default, create a Date/Time header for your local system using GMT. If you would like to override the date/time calculation set the DateTime property to a valid date/time string in the format defined by RFC 822 & RFC 1123. Example:
Mailer.DateTime = "Fri, 02 May 1997 10:53:49 -0500"
The encoding type for attachments. The default setting is MIME.
Valid values:
Example:
Mailer.Encoding = 1
The message originator’s name.
Example:
Mailer.FromName = "Joe’s Widget Shop"
Tthe message originator’s email address.
Example:
Mailer.FromAddress = joe@widgets.com
Sets the Organization header in the message.
Example:
Mailer.Organization = "Your Company Name"
Sets the message priority. Priorities are 1-5 and are reflected in the X-Priority
Valid values:
-
1 – High
-
3 – Normal
-
5 – Low
Example:
Mailer.Priority = 1
The remote SMTP host that the message will be sent through. This is typically an SMTP server located at your local ISP or it could be an internal SMTP server on your companies premises. Up to 3 server addresses can be specified, seperated by a semicolon. If the primary server is down the component will attempt to send the mail using the seconary server and so on.
Example:
Mailer.RemoteHost = "mailhost.myisp.net"
or
Mailer.RemoteHost = "mailhost.myisp.net; mailhost.myotherisp.net"
The ReplyTo property allows you to specify a different email address that replies should be sent to. By default mail programs should use the Reply-To: header for responses if this header is specified.
The Response property returns any error messages that may occur.
The ReturnReceipt flag. If this is set to true AND the recipients SMTP server supports this feature (and it is enabled) the recipients SMTP server will send a notice back to the FromAddress confirming that this email has been delivered.
Example:
Mailer.ReturnReceipt = false
If you need to debug the session give a log file name here. Make sure the IUSR_XYZ IIS user has security that allows the component to write to this file. Warning: Do not use this setting in situations where multiple users can access this component at the same time. This is for single user debugging ONLY!
Example:
Mailer.SMTPLog = "c:\smtplog.txt"
The message subject.
Example:
Mailer.Subject = "Stock split announced!"
The SuppressMsgBody property is true by default and is used in conjuction with the SMTPLog property. When SMTPLog is set to a file and SuppressMsgBody is true the log file receives a copy of the message text. If SuppressMsgBody is false the message text is not sent to the log.
Timeout is the maximum time that AspMail should wait for a response from the remote server. The default is 30 seconds.
Example:
Mailer.Timeout = 15
The urgent flag sets the X-Urgent header in the outgoing message. Not all mail readers support this flag.
Example:
Mailer.Urgent = true
MS-Mail priority headers, by default, are sent in addition to the standard SMTP priority headers. You can turn MS-Mail headers off with this property
Example:
Mailer.UseMSMailHeaders = false
Gets the internal component version number.
Example:
Response.Write "Component Version: " & Mailer.Version
The WordWrap property is off by default. Setting WordWrap to true causes the message body to wordwrap at the position specified by the WordWrapLen property.
The WordWrapLen property is set to 70 by default. You can modify the position that wordwrap occurs by changing this value.