Sending e-mail with CDOSYS
Bookmark this page Print this page
Article Applies To: All Windows server based hosting packages

Operating Platform
This article applies to Windows hosting accounts only.

Sending e-mail with CDOSYS
CDO (Collaboration Data Objects) is a Microsoft technology that is designed to simplify the creation of messaging applications.

CDOSYS is a built-in component in ASP. We will show you how to use this component to send e-mail with ASP.

What about CDONTS?
Microsoft has discontinued the use of CDONTs on Windows 2000, Windows XP and Windows 2003. If you have used CDONTs in your ASP applications, you should update the code and use the new CDO technology.

An example showing how the component may be used within an ASP script to send an e-mail is listed below: -


' D E C L A R A T I O N S
Dim objMail, objConfig, objFields

' A S S I G N M E N T S
Set objMail = Server.CreateObject("CDO.Message")
Set objConfig = Server.CreateObject("CDO.Configuration")
Set objFields = objConfig.Fields

' S E T   C D O S Y S   C O N F I G U R A T I O N
objConfig.Fields.Item("") = 2
objConfig.Fields.Item("") = "localhost"
objConfig.Fields.Item("") = 10
objConfig.Fields.Item("") = 25

' S E N D   T H E   M A I L
Set objMail.Configuration = objConfig
objMail.From = "" ' Your e-mail address
objMail.To = "" ' The recipient's address
objMail.Subject = "Test E-Mail"
objMail.TextBody = "This e-mail was send using CDO"

' C L E A N   U P
Set objMail = Nothing
Set objConfig = Nothing
Set objFields = Nothing

Response.Write "Mail Submitted"


Last Modified: 18/12/2007
© 2004 - 2014 Storm Internet Ltd