read out a txt and send the last line to email adress - vbscript
- by matthias
Hallo,
I'm back haha :-) so i have the next question and i hope someone can help me...
I know i have a lot of questions but i will try to learn vbscript :-)
Situation:
I try to make a program that check all 5 min a txt and if there a new line in the txt, i'll try to send it to my eMail Address
Option Explicit
Dim fso, WshShell, Text, Last, objEmail
Const folder = "C:\test.txt"
Set fso=CreateObject("Scripting.FileSystemObject")
Set WshShell = WScript.CreateObject("WScript.Shell")
Do
Text = Split(fso.OpenTextFile(Datei, 1).ReadAll, vbCrLF)
Letzte = Text(UBound(Text))
Set objEmail = CreateObject("CDO.Message")
objEmail.From = "[email protected]"
objEmail.To = "[email protected]"
objEmail.Subject = "Control"
objEmail.Textbody = Last
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = _
"smtpip"
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objEmail.Configuration.Fields.Update
objEmail.Send
WScript.Sleep 300000
Loop
This program works, but this program send me all 5 mins a mail...but i will only have a new mail when there is a new line in the txt.
Can someone help me?