Frequently Asked Questions

Help Center Search

How do I enable CDO.MESSAGE with MailEnable?

Print this Article
Comment on this Article
Last Updated: August 28, 2007 12:10 PM

To send an email with Active Server Pages requires a component such as CDO.MESSAGE, which is supported on our Windows shared hosting servers.

In order to use MailEnable and CDOSYS at the same time you will need to change the Internet Information Services (IIS) SMTP port to port 8025 using the General tab in the SMTP virtual server properties dialog box. For more information on how to do this see Microsoft Windows Server Tech Center.

Next, you will need to add additional lines of code to the Code Snippet for CDO Messages.

Set objMail = Server.CreateObject("CDO.Message")
objMail.From = "YOUR FROM EMAIL ADDRESS"
objMail.To = "YOUR TO EMAIL ADDRESS"
objMail.Subject = "YOUR EMAIL SUBJECT LINE"
objMail.TextBody = "YOUR MESSAGE BODY"
objMail.Send

Set objMail = Nothing

Now, modify the Code Snippet for CDO Messages as follows.

sch = "http://schemas.microsoft.com/cdo/configuration/"
Set cdoConfig = Server.CreateObject("CDO.Configuration")
With cdoConfig.Fields
.Item(sch & "sendusing") = 2 ' cdoSendUsingPort
.Item(sch & "smtpserver") = "127.0.0.1" (add your smtp server address here)
.update
End With

Set objMail = Server.CreateObject("CDO.Message")
Set objMail.Configuration = cdoConfig
objMail.From = "YOUR FROM EMAIL ADDRESS"
objMail.To = "YOUR TO EMAIL ADDRESS"
objMail.Subject = "YOUR EMAIL SUBJECT LINE"
objMail.TextBody = "YOUR MESSAGE BODY"
objMail.Send

Set objMail = Nothing
Set cdoConfig = Nothing

For more information about CDOSYS, see MSDN.