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
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