Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CDOSYS Examples

Status
Not open for further replies.

rjkealey

Programmer
Feb 14, 2003
84
0
0
US
Hey All,
Wondering if there is a good tutorial and example code to play with trying to learn how to sned a form via email after it is filled out by client
Any help would be greatly appreciated.
I am a newbie and part timer at this so I would need a good simple example
RJKealey
 
Are there any free ones that is a purchase one I just need to see it in action that you have to buy before you see it in action
 
Here's a snippit from the code that I use for this. It should be pretty self-explaining.

Code:
	Set objNewMail = Server.CreateObject("CDONTS.NewMail")
	objNewMail.From = "Notify@yourcompany.org"
	objNewMail.To = strAddress
	objNewMail.Subject = strTopic
	objNewMail.Body = strBody
	objNewMail.BodyFormat=0
	objNewMail.MailFormat=0
	' Everything set?  Send it off!
	objNewMail.Send
	' Since this is a one-shot thing, the object needs to be re-created each time for each mail.
	Set objNewMail = nothing

... this assumes that the strings are already loaded: i.e. strAddress is the e-mail address that it's going to; strTopic is the topic of the e-mail, strBody is the full text of the body of the e-mail.

Keeping in mind that if you're going to send several, you either need to use a pre-defined distribution list, a semi-colon separated list of e-mail addresses, OR, loop through the routine several times.



Just my 2¢

"In order to start solving a problem, one must first identify its owner." --Me
--Greg
 
Are there any free ones that is a purchase one I just need to see it in action that you have to buy before you see it in action

The site posted had an example of using cdonts which comes with windows and only needs to be registered and have a outgoing SMTP server setup. I think you were reading the advertising on the site and not reading the content


____________ signature below ______________
General FAQ faq333-2924
5 steps to asking a question faq333-3811
 
What, nobody liked my code? :p~



Just my 2¢

"In order to start solving a problem, one must first identify its owner." --Me
--Greg
 
Correct me if I'm wrong but wasn't the CDONTS replaced by CDOSYS in Win2k, Win2k3, etc?

Here's some sample code using the new CDOSYS;
Code:
Dim objCDOSYSCon 		
Set objCDOSYSMail = Server.CreateObject("CDO.Message") 
Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration") 
	objCDOSYSCon.Fields("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserver")[/URL] = "127.0.0.1" 
	objCDOSYSCon.Fields("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserverport")[/URL] = 25 
	objCDOSYSCon.Fields("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusing")[/URL] = 2 
	objCDOSYSCon.Fields("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout")[/URL] = 60 
	objCDOSYSCon.Fields.Update 
		
Set objCDOSYSMail.Configuration = objCDOSYSCon 
	objCDOSYSMail.From = strFrom
	objCDOSYSMail.To= strTo
	objCDOSYSMail.Subject = strSub 

	'use one or the other but not both
	objCDOSYSMail.HTMLBody = strHTMLtext
	objCDOSYSMail.TextBody = strtext

	objCDOSYSMail.Send

Good luck and hope this helps,
 
The code I posted runs on a W2K3 server......



Just my 2¢

"In order to start solving a problem, one must first identify its owner." --Me
--Greg
 
as long as you register the cdonts.dll on Win2003 it doesn't matter. CDOSYS is (or they say) better in some aspects but if you are migrating applications it is very common to do just that.

if you are starting off with win2003 then you should probably go with cdosys simply to stay current but sense I didn't see that in the question of
CDOSYS Examples

it really isn't relevant

gbaughma code is a good example. just thought I would post to the fact the original poster didn't pay close enough attention and the link was spot on for the question


____________ signature below ______________
General FAQ faq333-2924
5 steps to asking a question faq333-3811
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top