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!

VBScript - Email Alert when Log gets too large

Status
Not open for further replies.

Alexial

Programmer
Nov 26, 2008
36
US
I'm working a script for work right now to alert me when the log for one of our programs gets too large. I temporarily set the filepath to C:\log.txt, and the file size limit to 2kb to more easily test it.

I'm pretty sure the finding the file part is fine, but when it comes to sending out the email- it never seems to go. I double checked the emails (mine was wrong lol) and tried again- still nothing.

1) I checked our SMTP server to make sure the 'From' email was allowed. (I also created a mailbox for the 'From')
2) Checked our mail archives to see if it even went out, and it if it ever tried to get to my mailbox. (it wasn't there)
3) Double checked the IP/port in the script with the boss man.
4) Tried it on both vista and XP to see if it was some sort of security issue preventing that part of the script from executing.

Is there something I'm missing? Here's what I have below I get no errors what-so-ever when running it.

Dim objNet, file

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile("C:\Log.txt")
Set myMail=CreateObject("CDO.Message")

If objFSO.FileExists("C:\Log.txt") Then
set file = objFSO.GetFile("C:\Log.txt")
If file.Size >= 2000 Then
myMail.Subject="TempDB - JDE Log File Reaching Maximum"
myMail.From="TDBLogMoniter@temp.com"
myMail.To="solism@temp.com"
myMail.TextBody="Temp DB Log is at " & (objFile.Size) & "kilobytes. Please reboot the server."
myMail.Configuration.Fields.Item _
(" 'Name or IP of remote SMTP server
myMail.Configuration.Fields.Item _
(" _
="10.1.1.71"
'Server port
myMail.Configuration.Fields.Item _
(" _
=25
myMail.Configuration.Fields.Update
myMail.Send
set myMail=nothing
End If
End If
 
How the heck do I edit my messages x.x I need to remove the emails.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top