1 '///Wriiten by Ed Dondlinger 1/23/2009 - edondlinger@thepylegroup.com ///
3 '/// MODIFY THE VARIABLES LISTED BELOW IN THE "USER VARIABLES" SECTION.
4 '/// THEN RENAME FILE WITHOUT THE ".example" SUFFIX.
6 '///Comment out the next line when testing, then change back when done. ///
9 'Get Time Zone info from local windows registry
10 set oShell
= CreateObject("WScript.Shell")
11 atb
= "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation\StandardName"
12 TZInfo
= oShell
.RegRead(atb
)
16 'XXXXXXXXXXXXXXXXXXXX USER VARIABLES XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
20 MyEmailSubject
= "COMMUNICATION FAILURE at: " & MyLocation
22 MyEmailFromAddress
= "xxx@zzz.com" 'you could also use this format to display the common name: """Me"" <user@mydomain.com>"
24 MyEmailToAddress
= "xxx@zzz.com"
26 MyTextBody
= "The APCUPS program has lost communication with the UPS at: " & MyLocation
& "." & _
27 vbCRLF
& "Reported by the APCUPS Server at: " & dateAdd("H",0,Now
) & " " & TZInfo
29 MySMTPServer
= "localhost" 'or use a IP address i.e. "10.x.x.x"
31 MyMailServerUserName
= "MyUserName"
33 MyMailServerPW
= "mypassword"
37 MySMTPServerSSL
= False
39 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
44 '////////// Email Section //////////
46 '*** NOTE: MSDN CDO Library can be referenced at: http://msdn.microsoft.com/en-us/library/ms872853(EXCHG.65).aspx
48 Const cdoSendUsingPickup
= 1 'Send message using the local SMTP service pickup directory.
49 Const cdoSendUsingPort
= 2 'Send the message using the network (SMTP over the network).
50 Const cdoSendUsingExchange
= 3 'Send the message using MS Exchange Mail Server.
52 Const cdoAnonymous
= 0 'Do not authenticate
53 Const cdoBasic
= 1 'basic (clear-text) authentication
54 Const cdoNTLM
= 2 'NTLM
56 Const cdoURL
= "http://schemas.microsoft.com/cdo/configuration/"
58 Set objMessage
= CreateObject("CDO.Message")
60 '/// Set the message properties. ///
64 .Subject
= MyEmailSubject
66 .From
= MyEmailFromAddress
68 .To = MyEmailToAddress
70 .TextBody
= MyTextBody
72 'Set Mail Importance level, you can set [high,normal,low]
73 .fields
.Item("urn:schemas:mailheader:importance").Value
= "high"
75 'Set Mail priority level, you can set [1=urgent, 0=normal, -1=nonurgent]
76 .fields
.Item("urn:schemas:mailheader:priority").Value
= 1
82 '/// This section provides the configuration information for the remote SMTP server. ///
84 with objMessage
.Configuration
.Fields
86 'Send Using method (1 = local smtp, 2 = remote network smtp, 3 = MS Exchange)
87 .Item(cdoURL
& "sendusing") = 2
89 'Name or IP of Remote SMTP Server
90 .Item(cdoURL
& "smtpserver") = MySMTPServer
92 'Type of authentication, NONE, Basic (Base64 encoded), NTLM
93 .Item(cdoURL
& "smtpauthenticate") = cdoBasic
95 'Your UserID on the SMTP server
96 .Item(cdoURL
& "sendusername") = MyMailServerUserName
98 'Your password on the SMTP server
99 .Item(cdoURL
& "sendpassword") = MyMailServerPW
101 'Server port (typically 25)
102 .Item(cdoURL
& "smtpserverport") = MySMTPServerPort
104 'Use SSL for the connection (False or True)
105 .Item(cdoURL
& "smtpusessl") = MySMTPServerSSL
107 'Connection Timeout in seconds (the maximum time CDO will try to establish a connection to the SMTP server)
108 .Item(cdoURL
& "smtpconnectiontimeout") = 60
116 '/// End remote SMTP server configuration section ///
122 Set objMessage
= nothing
125 '/// Exit with a 0 error level to ensure the apccontrol.bat continues ///