5,693,062 members and growing! (20,235 online)
Email Password   helpLost your password?
Web Development » ASP » General     Intermediate

A Beginner's Guide to CDOSYS

By rbeckett

Use CDOSYS instead of CDONTS on Windows 2000/XP
Win2K, WinXP, Win2003, Windows, ASP, Dev

Posted: 5 Sep 2003
Updated: 5 Sep 2003
Views: 171,707
Bookmarked: 21 times
Announcements
Loading...



Search    
Advanced Search
Sitemap
12 votes for this Article.
Popularity: 4.15 Rating: 3.85 out of 5
1 vote, 8.3%
1
1 vote, 8.3%
2
3 votes, 25.0%
3
2 votes, 16.7%
4
5 votes, 41.7%
5

Sample Image - cdoex.gif

Introduction

Use this example to allow users of your website to submit feedback and send emails using IIS and its SMTP service.

Background

CDOSYS is the successor of CDONTS, an easy way to send emails from webpages. Unfortunately, CDONTS was discontinued in Windows XP, so web authors must now use CDOSYS instead. CDOSYS is as easy to use as CDONTS, however CDOSYS also allows authors to create much more sophisticated emails using html and datasources.

Requirements

  • Windows 2000/XP
  • SMTP Service for IIS installed
  • Run this sample on your own computer with IIS installed.
  • Put the files in a web server directory.
  • Do not open the htm page in Windows explorer and expect it to work. You must use the internet so that IIS is involved in the processing. For example, http://www.mydomain.com/sample1.htm will work. c:\downloads\sample1\sample1.htm won't work.
  • Using JScript as the .asp language doesn't work as easily as vbscript does.

Using the code

The first step is to call the components into action...

Dim iMsg
Set iMsg = CreateObject("CDO.Message")
Dim iConf
Set iConf = CreateObject("CDO.Configuration")

Step 2 involves verifying the correct configuration settings...

Dim Flds
Set Flds = iConf.Fields
Flds("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1
Flds( _
 "http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory") _
  = "c:\inetpub\mailroot\pickup"
Flds.Update

Be especially mindful of the path in the code above. Step 3 shows how the message is constructed...

Set iMsg.Configuration = iConf
iMsg.To = Request.Form.Item("Email")
iMsg.From = "put_in_your_email_address_here@domain.com"
iMsg.Subject = Request.Form.Item("Subject")
iMsg.TextBody = Request.Form.Item("EContent")
iMsg.Send            

The Request.Form.Item grabs the data posted to it from the form on the sample1.htm page.

Points of Interest

This is really the tip of the iceberg. There is so much more that you could do with CDOSYS (and CDOEX). See http://msdn.microsoft.com/library/default.asp?url=/nhp/default.asp?contentid=28000408 for more details...

History

  • Sept. 6/03 - Posted this article

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

rbeckett


It's Frum the Slum
Occupation: Web Developer
Location: Canada Canada

Other popular ASP articles:

Article Top
Sign Up to vote for this article
You must Sign In to use this message board.
FAQ FAQ Noise ToleranceSearch Search Messages 
 Layout  Per page   
 Msgs 1 to 25 of 26 (Total in Forum: 26) (Refresh)FirstPrevNext
Generalsender's name along with words in subjectmemberBrendaBachman4:00 2 Mar '06  
Generalcreate a .eml file and i move that eml file in the specific foldermemberjituyadav21:40 6 Feb '06  
GeneralFirst-Last Name ValuessussRob3610:29 5 Oct '05  
Generala questionmemberfly0919:10 12 Mar '05  
GeneralJScript (Using ASP and MYSQL) - EMailsussKush Mashru5:53 8 Feb '05  
GeneralHelpsussAnonymous5:43 28 Sep '04  
GeneralRe: HelpsussAnonymous19:58 10 Oct '04  
Generalmessages not being sentmembergriffett4:19 24 Jun '04  
GeneralRe: messages not being sentmembermods20055:48 1 Mar '05  
GeneralCDOSYS vs CDONTSsussspankie8:02 15 Jun '04  
GeneralRe: CDOSYS vs CDONTSsussAnonymous19:00 15 Jun '04  
GeneralCDOSYS vs CDONTSsussAnonymous8:00 15 Jun '04  
GeneralDoesnt workmemberMaxxxDamage20:19 23 Apr '04  
GeneralRe: Doesnt workmemberraviegopal22:16 8 Jun '04  
GeneralRe: Doesnt workmembersteve7287:55 26 Jun '04  
GeneralRe: Doesnt worksussAnonymous2:23 29 Oct '04  
Generalc:\inetpub\mailroot\pickup ?????memberzahidrahim20:15 12 Mar '04  
GeneralRe: c:\inetpub\mailroot\pickup ?????sussAnonymous7:57 21 Mar '04  
GeneralI cant download the zipsussAnonymous10:06 1 Feb '04  
GeneralImagesussAnonymous10:41 11 Dec '03  
Generaland jscript?sussAnonymous9:43 4 Nov '03  
GeneralRe: and jscript?sussScidd0w4:48 30 Jan '04  
GeneralRe: and jscript?sussMario Vargas6:08 21 Apr '04  
GeneralCDOSYS, not CDOEXmemberkojiishi17:17 7 Sep '03  
GeneralRe: CDOSYS, not CDOEXmemberrbeckett19:33 7 Sep '03  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 5 Sep 2003
Editor: Nishant Sivakumar
Copyright 2003 by rbeckett
Everything else Copyright © CodeProject, 1999-2008
Web18 | Advertise on the Code Project