Design-a-Might Web Hosting

CDONTS - ASP Mail Script
ASP Hosting Help

Main Help
Domain Transfer
Account Info
Control Panel
Email Manager
FTP Info
FrontPage Help
ASP Help
Unix Shell
Telnet
Perl Scripts
Windows CDonts
Database Use
Securing Sites
Contact Support

CDONTS - ASP Mail Script

Rather than use the Form mail Script, windows accounts can use CDONTS NewMail object in ASP pages. The NewMail object allows you to easily and quickly add simple mail sending capability to a web page.

ASP VBScript Example

Set objSendmail = CreateObject("CDONTS.NewMail")
objSendMail.Send From, To, Subject, Body, Importance
Set objSendMail = NOTHING

The above code is all that is required to create and send a mail message. So lets go through what's happening.

Line 1 creates an instance of the NewMail object
Line 2 sends the message, using the send method of the object
Line 3 releases the object and frees its resources.

In addition to specifying the 5 properties directly in the send method an alternative is to specify each property value for the NewMail object.

Set objSendmail = CreateObject("CDONTS.NewMail")
With objSendmail
  .From = "your email here"
  .to = "recipient email here"
  .Subject = "Greetings"
  .Body = "How have you been"
  .Importance = CDOHigh
  .Send
End With
objSendMail = NOTHING

That's all there is to it, this second method produces the same result as the first. But also enables other Methods and Properties of the NewMail object to be set prior to using the send method.

For further reading check out the following links.

Microsoft also provide a CDO Type Library which allows the use of CDO constants instead of their associated values (CDOHigh = 2 in the above example). To use these constants you will need to include the following line in your ASP page :-

<!--METADATA TYPE="typelib"
      UUID="CD000000-8B95-11D1-82DB-00C04FB1625D"
      NAME="CDO for Windows 2000 Type Library" -->

Are you happy with your current host.?

Our Professional Domain Hosting is fast, reliable and feature packed. ASP.NET, ASP, FrontPage, Databases, FREE Secure Server space and much more in our Standard windows account for only £60/year (approx $85).

See our Web Hosting section for full details

Design-a-Might, 5 Cobble Carr, Guisborough. TS14 6NR United Kingdom
Email : sales@design-a-might.co.uk Website : www.design-a-might.co.uk
Copyright© Design-a-Might 2000. All rights reserved.