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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

.vbs and CdONTs

Status
Not open for further replies.

beruken

Programmer
Mar 12, 2002
22
US
I wish to create a Cdonts email object in a vbs file and have it execute on command (not from an ASP page) but I am not sure how to write it. I put a small app together and got no errors nor e-mails. Any clue?

dim myMailer
set myMailer = server.createObject("Cdonts.NewMail")
MyMailer.To = "me@home.com"
MyMailer.Body = "Test message"
MyMailer.Send

Do I have to reference the CDONTS DLL?
 
1) If you executed this thru a .VBS file on the desktop, the following line of code should've produced an error because the server object doesnt exist in WSH.

set myMailer = server.createObject("Cdonts.NewMail")

Change Server to WScript.

2) If you need CDO examples, head over to the MSDN were they're readily available for all the various CDO libraries. Here's you a simple one w/ CDONTS:

Set oMail = WScript.CreateObject("CDONTS.NewMail")
oMail.From = "Me@Tek-tips.com"
oMail.To = "You@Tek-tips.com"
oMail.Subject = "CDONTS Test"
oMail.Body = "This is a test using CDONTS."
oMail.Send
Set oMail = Nothing Jon Hawkins
 
Jon, Thank You. I had resolved the problem already. The code I posted was not what I wrote. I just used creatObject without specifying WScript.CreateObject. Funny thing is the e-mail was going to my Badmail folder because I didn't specify the From addess. Anyway thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top