Jump to content

file checker and then email


 Share

Recommended Posts

Hi all.

I have try to make an application theres checks the folder c:\download\*.log

- need the script to include sub folders also....

- only send the email once for the same file , with the full file name included (more than one file with the same file extension could come)

- the script should not exit but keep checking the folders

can anone help me?

/T

This is the code I have so far.

While 1 
If FileExists("C:\download\*.log") Then
    MsgBox(4096, "File exists", "File exists",5)
    
    
$file = FileOpen("C:\download\email.vbs", 1)
$To = "myemail@hotmail.com"
$From = "noone@blackhole.com"
$Subject = "Your Subject Here"
$TextBody = "What you want in plain text!!!"
$SMTP = "smtp.mail.dk"
FileWriteLine($file, 'set imsg = createobject("cdo.message")')
FileWriteLine($file, 'set iconf = createobject("cdo.configuration")')
FileWriteLine($file, ' ')
FileWriteLine($file, 'Set Flds = iConf.Fields')
FileWriteLine($file, 'With Flds')
FileWriteLine($file, '.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2')
FileWriteLine($file, '.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "' & $SMTP & '"')
FileWriteLine($file, '.Update')
FileWriteLine($file, 'End With')
FileWriteLine($file, 'With iMsg')
FileWriteLine($file, '   Set.Configuration = iConf')
FileWriteLine($file, '    .To = "' & $To & '"')
FileWriteLine($file, '    .From = "' & $From & '"')
FileWriteLine($file, '    .CC = ""')
FileWriteLine($file, '    .Subject = "' & $Subject & '"')
FileWriteLine($file, '    .TextBody = "' & $TextBody & '"')
FileWriteLine($file, '    .fields.update')
FileWriteLine($file, '    .Send')
FileWriteLine($file, 'End with')
FileWriteLine($file, 'set imsg = nothing')
FileWriteLine($file, 'set iconf = nothing')
FileClose($file)
Sleep(1000)
; Run("wscript.exe C:\email.vbs", "C:\")
Sleep(2000)
FileDelete("C:\download\email.vbs")

    
    Exit
EndIf
Sleep(1000)
WEnd
Edited by borup
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...