Getting CDONTS to work on Windows Server 2008 x64

Tags: IIS, SMTP, Classic ASP, ASP

A few questions come up in the forums @ http://forums.iis.net about people moving Classic ASP applications that use CDONTS.  CDONTS was introduced in NT4 and was widely popular.  With the success of ASP applications 'back in the day', many used CDONTS to send emails from their application.   Windows Server 2008 x64 introduces a different challenge.  Here is the procedure I used to get CDONTS working.

1) Copy CDONTS.dll from another server to C:\Windows\SysWOW64

2) Run regsvr32 c:\windows\SysWOW64\cdonts.dll

3) 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.

4) I'm assuming you have installed the SMTP Service located in Server Manager > Features > SMTP Server option

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

'Enable logging
http://weblogs.asp.net/steveschofield/archive/2007/03/25/want-help-with-iis-smtp-service-please-enable-logging.aspx

'Ensure logging will work on x64
http://weblogs.asp.net/steveschofield/archive/2008/02/29/windows-server-2008-smtp-service-logging-tip.aspx

6) Test using code listed below.

Here is the code to run CDONTS webpage.

<%
    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 = "Thank you for order from www.iislogs.com." & vbCrLf
    CDONTSMail.Body= strBody
    CDONTSMail.Send
    set CDONTSMail=nothing
%>

I recommend you use CDOSYS instead of CDONTS, however if you are trying to migrate from NT4, 2000/2003 and don't want to make code changes, hope this helps. 

PS:I tested this using Network Service as the application pool user, a custom application pool user, IUSR (default anonymous authentication module user) and the Anonymous Authentication module inherit the application pool user as network service and a custom user.  If you are having permissions issues, enable auditing and use process monitor.  

Here is a article that can help with auditing.  http://weblogs.asp.net/steveschofield/archive/2008/03/07/detecting-permission-issues-using-auditing-and-process-monitor.aspx

Cheers,

Steve

7 Comments

  • Jesse Cabral said

    The problem remained until I changed the application pool for the site to allow 32bit application support. Something for others to keep in mind.

  • Dee said

    For others: Some windows 2008 web edition accounts require you to run cmd as administrator to execute the regsvr32 command.

    Thanks Steve windows legend...

  • Jorge said

    I also had to grant permisions to IUSR on the c:\inetpub\mailroot folder in order to avoid a "Microsoft VBScript runtime error '800a0046' Permission denied" error.

    Thanks for the tip.

  • Alex Alden said

    Great tip thanks … I have found that in addition to get it working on my site I needed to change the identity in the application pool settings from ApplicationPoolIdentity to NetworkService. I then granted NetworkService modify permissions on the pickup folder. I hope this is useful to someone else .

Add a Comment