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

vbs script to send an email via smtp

Status
Not open for further replies.

jsty

Technical User
Jan 7, 2005
65
US
using vbs to send email alert of alarm using SMTP. Works good. Now being asked to limit the email alerts to one per hour. Any ideas in VBS ?

In other words, need someway to ignore the request for 1 hour after one has been received.
 
you can make your vbs sleep for an hour....or you can grab that value your making it sleep for from a db/somewhere else..

Code:
WScript.Sleep 300000

code above would sleep for 5 minutes. the Value is in milliseconds
 
I want to monitor my exchange server, if it is low on disk space I want to have perfmon send me an email.

Can I get a copy of the vbs code you are using to send SMTP email?
 
Try this...

Code:
Set objMessage = CreateObject("CDO.Message") 

objMessage.Sender = "SomeValidLocalEmailAddress@yourdomain.com" 
objMessage.To = "destinationAddress@anyDomain.com"
objMessage.TextBody = "Whatever you want to say in body.."	
objMessage.Subject = "Whatever you wanna say in subject..." 

'This section provides the configuration information for the remote SMTP server.

objMessage.Configuration.Fields.Item _
("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusing")[/URL] = 2 

'Name/IP of SMTP Server
objMessage.Configuration.Fields.Item _
("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserver")[/URL] = "yourSMTPServer.yourdomain.com"

'Server port  
objMessage.Configuration.Fields.Item _
("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserverport")[/URL] = 25 

objMessage.Configuration.Fields.Update
objMessage.Send

Use your resources, you're on the internet!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top