![]() Capt. Horatio T.P. Webb |
Parks -- SPRING 2009 | |
Using ASP it is easy to send emails. First you create a mail object by saying:
Set CDONT_object_name = Server.CreateObject("CDONTS.NewMail")
Then the following object properties can be defined:
This property is REQUIRED. If you follow the email address by (optional name to appear) this name appears on the email in the "To" field. This optional name enclosed in parentheses MUST be inside the quotes. You may use more than one email address by separating the addresses with a semicolon.
This property is REQUIRED.If you follow the email address by (optional name to appear) this name appears on the email in the "From" field. This optional name enclosed in parentheses MUST be inside the quotes.
Copies of the email is sent to this address. You may use more than one email address by separating the addresses with a semicolon.
This field sends blind copies of the email to the recipients listed. This means that recipients receiving blind copies DO NOT see the other email recipients who were sent the same email. You may use more than one email address by separating the addresses with a semicolon.
The text in quotes appears in the recipients Subject field
If you wish the format of the email to be HTML you use as 0 (zero). For plain text use a 1 (one). If you do not specify this property, the Body format is defaults to 1 (i.e., plain text).
If you set the .BodyFormat to zero (i.e., HTML) you will also need to set this property to zero.
This sets the importance of the email. 0=low, 1=normal (the default) , 2=high.
This sets an alternative email address for reply. If the recipient clicks "reply" this alternative email address is used -- NOT the one specified in the "from" property.
This sets the text to appear in the body. When sending text (not HTML) you may wish to use the character pair: Chr(13)+Chr(10) to terminate lines (i.e., create short lines). Otherwise the text will appear as one long string.
To attach a file to the email, the path/filename must appear in quotes. If you include a name in parentheses, the name appears in the email rather than the path/filename. This second parameter is optional.
This syntax provides the ability to include an attachment (e.g., an image) in the email body. You would assign the BodyFormat and MailFormat both to 0 (i.e., HTML). Then inside the .body text you would use the name to appear in the body tag to reference the file to appear.
e.g., if you wish to display an image in body of the email (i.e., in the HTML) you would use:
This sends the email.
You should remember to destroy the email object when done:
Set CDONT_object_name = nothing
Further any user executing the asp program (normally the anonymous Internet user named "IUSR_Internet") containing the CDONT commands must have privileges (read and execute) to the directory "inetpub\mailroot".