Bookmark and Share Subscribe Bookmark and Share

Categories

Unique Page Views

  • 6829


Install CDONTS mail component and SMTP on Windows Server 2008

Mar
27
 « »    

CDONTS is mail component used to send messages from an ASP page. Instead of recoding multiple web sites I have created, I am just going to install the component on my Windows Server 2008.

Configuration Information

Platform: Hyper V Host (http://www.microsoft.com/windowsserver2008/en/us/hyperv.aspx)
OS: Windows Server 2008
Installation Media: CDONTS.zip – You can download the version I used here.
CPU: 2 dedicated 2.0Ghz
RAM: 1024mb
Disk: 40GB
Notes: IIS 7 has already been installed

Background

You can see here my sendmail.asp is calling CDONTS when it creates the message.

If CDONTS is not installed and I press send on my mail form I get this error

Installing CDONTS

Copy CDONTS.dll to c:\windows\system32 (You can download the version I used here)

Open the command prompt and run "regsvr32 c:\windows\system32\cdonts.dll"

Press OK when registration succeeds

Installing SMTP

Open Server Manager, you can open this several different ways in Windows Server 2008. Probably the quickest way to open Server Manager is to right click "My Computer" and choose "Manage", another way is open "Control Panel" go to "Program and Features" and select "Turn Windows features on or off". A third way to open it is "Server Manager" option under Administrative Tools.

Under Features, select Add Roles

Check the check box off next to "SMTP Server"

IIS will figure out what else it needs and create a list of required features, Press "Add Required Features"

Now there should be a check in the check box next to "SMTP Server", Press "NEXT" to continue

Press "Install" to continue with the installation

You should see a message indicating the Installation has succeeded, Press "Close" to continue

Configure SMTP Server

Make sure when you when you install the SMTP service, you enable Relay for localhost. Go to Administrative Tools > Internet Information Services (IIS6) > SMTP Virtual Server > Right click, Properties > Access Tab > Relay button > Add 127.0.0.1 in the option

Configure SMTP Security

Grant the appropriate permissions on C:\inetpub\mailroot\pickup (I granted USERS group Modify permissions). You could get permission denied if the folder security isn’t adjusted.

Testing

This is my contact form that uses the CDONTS component

No more 500 error, the message was sent out successfully

You can also test using the using the following code in an ASP page. Here is the code to test CDONTS in an ASP page.

Create a TEST.ASP with the following code and put the file in C:\Inetpub\wwwroot. Change the "CDONTSMail.To=" value to your e-mail address. Navigate to http://localhost/test.asp, if all is configured ok then you should receive the mail message. If you do not receive the e-mail check the folders under c:\inetpub\mailroot to see if its queued up.

<%

Dim strBody
Dim CDONTSMail
Set CDONTSMail = CreateObject("CDONTS.NewMail")
CDONTSMail.From= "user@example.com"
CDONTSMail.To= "user@example.com"
CDONTSMail.Subject="This is a Test email"
strBody = "This is a test message." & vbCrLf
CDONTSMail.Body= strBody
CDONTSMail.Send
set CDONTSMail=nothing

%>



16 Responses to “Install CDONTS mail component and SMTP on Windows Server 2008”

  1. John says:

    For those who are still getting errors when trying to register cdonts.dll, if your OS is 64-bit, you have to copy cdonts.dll into C:\Windows\SysWOW64 instead of C:\Windows\System32, and then run “regsvr32 cdonts.dll” from inside that folder. That’s what worked for me on Windows 2008 64-bit.

  2. Filippo Franchini says:

    Any hints on getting CDONTS to work under fu..ing Windows 7?

  3. Hans says:

    What if my ISP does not want to install the component. I like to re-code my sendmail_cdo.asp but have no clue how to do that. Any help much appreciated!

    • JPPinto says:

      my advise to you would be to check out which components they do support, then finding an ASP script that is compatible with those components. Or just beg your ISP to drop the file on the server.

  4. Greg says:

    Excellent article, just what I was looking for.

    Although under the section ‘Installing SMTP’ you say “Probably the quickest way to open Server Manager is to right click “My Computer” and choose “Manage”, incorrect, that opens the Computer Management screen, not Server Manager :p

    Thanks for a great article, among a sea of useless articles out there.

  5. Jon says:

    Got my CDONTS working on Windows 2008 but if the from is set as something not containing @ symbol, it doesn’t work. Is there a windows setting i can update to get around this?

  6. Karl says:

    Followed this guide (and others!) and still had my legacy app fail with a 500 error. Finally traced the problem to the application pool…. If you are using a 64bit OS remember to enable 32bit app support in the application pool.

Leave a Reply