Setting up IIS Email Using CDONTS

| No Comments | No TrackBacks

CDONTS is a component for sending emails in Active Server Pages (ASP) through Microsoft Windows NT Server. CDONTS has been replaced with CDOSYS on newer versions of Microsoft Windows servers. Although it has been replaced, some web applications are still using it and may need to use it if their websites are installed on older web servers, and developers may need to set it up on newer development web servers for testing purposes before deploying to the live web server.

 

Below is an example of the ASP code needed to configure and send an email using CDONTS.

Dim objCDO

Filename = "pic.gif"

            Set objCDO = Server.CreateObject("CDONTS.NewMail")

            objCDO.BodyFormat = 0

            objCDO.MailFormat = 0

            objCDO.To = "test@myemail.com"

            objCDO.CC = "test@myemail.com"

            objCDO.From = "test@myemail.com"

            objCDO.Subject = "Hello Test"

            objCDO.Body = "Body test"

           

            filepath = Server.MapPath("attachments\" & filename)

            objCDO.Attachfile filepath, filename, 1

            End if

           

objCDO.Send

            Set objCDO = Nothing

 

To configure CDONTS to work with IIS on versions of Microsoft servers newer than NT, download and install the CDONTS.dll to your C:\windows\system32 directory. Once the file is saved to the location, you will need to register this file on your computer. To do this, open up a command prompt (go to 'Start>Programs>Accessories>Command Prompt' and type:

            regsvr32 c:\windows\system32\cdonts.dll

 

Once CDONTS was set up, the emails were being saved to my Intetpub\mailroot\Queue folder, and they were never being sent. I downloaded a couple of pages to check the installed components and test sending an email, and there weren't any failures. CDONTS looked like it was set up correctly.

 

To configure IIS to send emails correctly, every website I looked at to solve the problem claimed to change the settings under 'Relay'. This can be accessed from right-clicking onto the SMTP server node in IIS, selecting 'Properties', viewing the 'Access' tab and clicking on the 'Relay' button to be taken to the screen where a new IP address or domain of the mail server could be added. This did not make a difference. Instead, go to the 'Delivery' tab and click the 'Advanced' button. In the text-field labelled 'Smart Host', type in the email server's domain name. Restart the SMTP node in IIS, and you should start receiving emails; no emails will be placed in the Queue folder.

Related Entries

No TrackBacks

TrackBack URL: http://jenikya.com/cgi-bin/mt5/mt-tb.cgi/3

Leave a comment

Archives

OpenID accepted here Learn more about OpenID