read out a txt and send the last line to email adress - vbscript
Posted
by matthias
on Stack Overflow
See other posts from Stack Overflow
or by matthias
Published on 2010-06-17T11:58:10Z
Indexed on
2010/06/17
12:03 UTC
Read the original article
Hit count: 256
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?
© Stack Overflow or respective owner