How to send email through CDONTS Email?

CDONTS stands for "Collaboration Data Objects for Windows NT Server" and as the name suggests it is for NT. The CDONTS component is installed when you install IIS on NT4, Windows 2000 and Windows 2003 servers.

Although, the component will run on Windows XP, Microsoft has decided to remove the component from IIS 5.1 on Windows XP, so you will have to track down a copy of the cdonts.dll and register it on the IIS web server.

To use this component to send an e-mail, you also need the SMTP Server that ships with IIS 4 or 5 installed on the web server. The SMTP server is usually installed by default with the standard IIS installation.


Sample code:

  1. <%
  2. Dim objCDOMail
  3. Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
  4. objCDOMail.From = "fromEmail@fromDomain.com"
  5. objCDOMail.To = "toEmail@toDomain.com"
  6. objCDOMail.Cc = "ccEmail@ccDomain.com"
  7. objCDOMail.Bcc = "bcc@mailDomain.com"
  8. objCDOMail.Subject = "Subject"
  9. objCDOMail.BodyFormat = 0
  10. objCDOMail.MailFormat = 0
  11. objCDOMail.Body = "MailBody"
  12. objCDOMail.Importance = 1
  13. objCDOMail.Send
  14. Set objCDOMail = Nothing
  15. %>


Explanation according to line:

  1. Open ASP tag
  2. Declare a variable named objCDOMail
  3. Create instance of Mailer control
  4. Set Mailer control properties and collection items
  5. Set Mailer control properties and collection items
  6. Set Mailer control properties and collection items
  7. Set Mailer control properties and collection items
  8. Set Mailer control properties and collection items
  9. Set Mailer control properties and collection items
  10. Set Mailer control properties and collection items
  11. Set Mailer control properties and collection items
  12. Set Mailer control properties and collection items
  13. Send Mail
  14. Release resources
  15. Close ASP tag

Note: This may please be noted that this component can be uniformly used by all the users of Windows Shared Hosting and Windows VPS (2003 OS).

  • 553 Users Found This Useful

Was this answer helpful?


Related Articles

How to use ASP Email?

ASPEmail 5.0 is an active server component for sending e-mail messages using an external SMTP...

How to use ASPSMS?

Here is the ASP VB-Script example, intended to be used on an IIS (Internet Information Server)...

How to send Emails via ASP using SMTP authentication?

This topic includes the sample code to send email from ASP.Net using C# code :Sample Code :<%@...

ASPJpeg support on Windows 2008 / 2012 servers

Yes, we have installed ASPJpeg component on Windows 2008 and Windows 2012 shared hosting servers....

How to use ASPUpload?

ASPUpload is a COM+ component, which enables an ASP application to capture, save and process the...