Sending e-mail with ASP
You can send e-mail from your website using ASP components. Two methods are
available with your package: CDO, the built-in component that comes with
Windows Server, or JMail, a third-party component.
Using CDO
The built-in Windows Server e-mail component is called CDO (Collaboration Data Objects). As an ASP programmer, you may be familiar with CDONTS, which was the e-mail component included with Windows NT. Microsoft has stopped supporting CDONTS. It is outdated, and no longer available with the current version of Windows Server. Korax uses the latest Windows Server products, so CDONTS is not available with your hosting package. To use CDO, follow these steps.-
At the top of the web page you are sending mail from, include an HTML comment tag
that will cause your ASP script to use the CDO type library. By using the
type library, you can replace numeric constants with text equivalents that
are easier to read. Make sure this is an HTML comment tag, placed outside of the
ASP delimiters.
<!--METADATA type="typelib" UUID="CD000000-8B95-11D1-82DB-00C04FB1625D" name="CDO for Windows Server Type Library" --> -
In the ASP script, create the CDO
Configurationobject. TheConfigurationproperty calledFieldsis also an object. Set theFieldsproperties to send mail using the local SMTP server, and call theupdatemethod onFields.Set iConf = CreateObject("CDO.Configuration")
iConf.Fields.Item(cdoSendUsingMethod) = cdoSendUsingPort
iConf.Fields.Item(cdoSMTPServer) = "localhost"
iConf.Fields.Update -
Create the CDO
Messageobject.Messagehas an object calledConfigurationas a property. Set it to theConfigurationobject you created in the previous step. Set the otherMessageproperties with the e-mail sender, recipient, subject, and body text. To send the e-mail message, call theMessageobject'sSendmethod.Set iMsg = CreateObject("CDO.Message")You can also send an HTML e-mail message by setting the HTMLBody property with the e-mail text, instead of the TextBody property.
Set iMsg.Configuration = iConf iMsg.To = "smith@example.com"
iMsg.CC = "jones@example.com"
iMsg.From = "pat@example.com"
iMsg.Subject = "Meeting today"
iMsg.TextBody = "Please attend today's meeting."
iMsg.SendiMsg.HTMLBody = "<em>Please attend today's meeting.</em>";
