I get a lot of email asking me how to determine if a server has SMTP
(also known as CDO for NT, or CDONTS) installed. Here's a little script that you can put on
the server and run to test email functionality.
I didn't make this a "live" example due to the potential for abuse, but I have tested this on
servers with and without CDONTS and it works. One note here: if you name the file cdotest.asp, you won't
have to change anything - just upload to the server and run the script. Otherwise, you will have to
remember to change the form action to your actual script name, as this script submits to itself.
<html>
<head>
<title>CDONTS Test</title>
</head>
<body bgcolor="#ffffff">
<center>
<table width="500">
<%
If request.form("action")="Test" then
on error resume next
Set Mail = CreateObject("CDONTS.Newmail")
if err.number = 0 then
Mail.From = request.form("UserName")
Mail.To = request.form("UserEmail")
Mail.Subject = "Your mail works!"
Mail.Body = "CDO for NT is available on your server"
Mail.Send
Set Mail = Nothing
%>
<tr>
<td align="center">
<b>Test Completed</b>
<p>Your email should arrive shortly
<% else %>
<td align="center">
<font face="arial">
<h3>Test Completed</h3>
<p>Your webserver does not support CDONTS.
<% end if %>
</td>
</tr>
<% Else %>
<tr>
<td align="center">
<font face="times new roman">
<h2><i>CDO for NT Test</i></h2></font>
<font face="Arial">
<form action="cdotest.asp" method="POST">
<p>If your server supports CDO for NTS you will receive e-mail
<br>confirmation within a few minutes of submitting the form.
<pre>
Your Name: <input type="TEXT" name="UserName" size="25">
Your E-Mail: <input type="TEXT" name="UserEmail" size="25">
</pre>
<p><center><input type="SUBMIT" name="action" value="Test">
<input type="RESET" value="Clear Form"></center></form></font>
</td>
</tr>
<% End If %>
</table>
</body>
</html>