' ****************************************************** ' * ' * Name: tst-cdo-mail.vbs ' * ' * Design Phase: ' * Author: John Miner ' * Date: 06/01/2010 ' * Purpose: A test program to send emails via ' * SMTP relay. ' * ' ****************************************************** ' ' Declare all variables ' Option Explicit ' ' Load the class library ' ExecuteGlobal CreateObject("Scripting.FileSystemObject").OpenTextFile(CurrentPath() & "mod-cdo-email.vbs").ReadAll ' ' Get The Current Program Path ' Function CurrentPath() CurrentPath = Replace(WScript.ScriptFullName, WScript.ScriptName,"") End Function ' ' Code to test the program - way 1 ' Public Sub Test1() ' Create the mail object Dim objMail Set objMail = New clsCdoEmail ' Set required email properties objMail.SMTP_SVR = "mail.corp.your-company.com" objMail.FROM_EMAIL = "donotreply@your-company.com" objMail.TO_EMAIL = "jminer@your-company.com" objMail.MSG_SUBJECT = "Stanley Cup Champions" objMail.MSG_BODY = "The Bruins just won the Stanley Cup!" ' Send a high priority email ' objMail.MSG_PRIORITY = MSG_HIGH ' Send a normal priority email objMail.MSG_PRIORITY = MSG_MED ' Send a low priority email ' objMail.MSG_PRIORITY = MSG_LOW ' Send the email objMail.SEND_EMAIL End Sub ' ' Code to test the program - way 2 ' Public Sub Test2() ' Create the mail object Dim objMail Set objMail = New clsCdoEmail ' Set required email properties objMail.SMTP_SVR = "mail.corp.your-company.com" objMail.FROM_EMAIL = "donotreply@your-company.com" objMail.TO_EMAIL = "jminer@your-company.com" objMail.MSG_SUBJECT = "Abraham Lincoln" ' Send optional properties objMail.BODY_TYPE = "HTML" objMail.MSG_ATT = "c:\vbs-depot\mail\Abraham-Lincoln.jpg" ' Load the html body objMail.LOAD_BODY("c:\vbs-depot\mail\tst-cdo-mail.html") ' Send the email objMail.SEND_EMAIL End Sub ' ' Execute the code ' Test2