Emailing using CDONTS and CDO

When setting up IIS you often need a quick way to check that the SMTP server is working. Depending on whether your server supports CDONTS or CDO, copy the code below into a .VBS file, amend the addresses and run!

CDONTS

Set msg = CreateObject("CDONTS.NewMail")
msg.From= "a@b.com"
msg.To= "a@b.com"
msg.Subject = "Test Message"
msg.Body= "This is a test message"
msg.Send
Set msg = Nothing

CDO

Set msg = CreateObject("CDO.Message") 
msg.Subject = "CDO Test Message" 
msg.From = "a@b.com" 
msg.To = "a@b.com" 
msg.TextBody = "This is a test message" 
msg.Send
Set msg = Nothing
Advertisements
This entry was posted in Reference and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s