ASP test mail script CDONTS – CDO for Windows Server

This tutorial will provide you with a test ASP CDONTS mail script which will help you to troubleshoot or just test whether the mail server is running fine on your Windows server.

Why the script is called CDONTS? Here is some description:

CDO (Collaborative Data Objects) is a programming interface from Microsoft for accessing MAPI-based e-mail, calendaring and scheduling servers. Originally called \"OLE Messaging\" and \"Active Messaging,\" CDO wraps the Enhanced MAPI library into a COM object that provides the ability to dynamically create Web pages. CDO is server oriented whereas MAPI has a client orientation.

CDONTS (CDO for Windows (NT) Server) is the SMTP version of CDO. It is widely used to send text e-mail and HTML-based e-mail from ASP pages. CDONTS was introduced with Internet Information Server 4 (IIS4) to make the Web server software fully Internet compliant.

Anyway, the script is written in one file which calls itself. It is divided in two parts – HTML form and ASP processor section.

Here is the form part(I keep it simple since I am using this only for testing purposes).

As you can see the \”form action\” is calling \"simple test mail script.asp\" so the processor file must be called in the same way. In the final version of the script I have merged the form and the processor in one file.
The second part of the script is the ASP processor which is setting the diminution variables CDO.Message, etc.

You can separate these, but I prefer to keep them into one simple ASP test mail script file.

Just copy the above and paste it into one file called: simple_test_mail_script.asp on our server. You can choose different name, just do not forget to change the form action section with the name you have chosen for your ASP mail script.


Filed Under: Windows 2003 Server

Anthony Gee About the Author: Anthony G. is an IT specialist with more than 9 years of solid working experience in the Web Hosting industry. Currently works as server support administrator, involved in consultative discussions about Web Hosting and server administration. One of the first writers in the website, now writing for Free Tutorials community - he is publishing tutorials and articles for the wide public, as well as specific technical solutions.

Comments (6)

  1. Roopali Rane says:

    Hi Sir. The cdont script is working great! – but when I start it for a first time it gives an error which is confusing my tests when I offer them to the customers. The error message is:

    CDO.Message.1 error ‘8004020d’

    At least one of the From or Sender fields is required, and neither was found.

    /simple_test_mail_script.asp, line 60

    Is there a way to remove this error?

  2. Tonny says:

    Hi Roopali. The error appears, because the cdont test mail script is calling itself, but there are no values yet.
    If you want to avoid this error, you have to separate the script as I’ve present it into the first two script boxes. Then the form will not send the request before filling the required test message fields.

  3. Greg Storm says:

    I have the same error as Rene. So if I want to avoid this error I have to separate the scripts, but that is not working for me.

  4. Greg Storm says:

    I forgot to tell that it gives me an error which says something like the CDONTS is missing.

  5. Tonny says:

    It is explained in the tutorial. Just make sure you have the correct file name set in the first script calling the CDONTS one

  6. Rooni says:

    I need aspX test mail script. If I try this one in aspx file, it returns bunch of errors

Leave a Reply