I updated post #13
Let me know if it works
Let me know if it works
If this is your first visit, be sure to check out the FAQ. You must register before you can post.
IMPORTANT: Your first post will be checked for appropriate content. This may take a bit of time.
sub main()
dim index , subject , body
index = hs.MailTrigger
subject = hs.MailSubject(index)
body = hs.MailText(index)
end_hook = instr(body,"Replies to this message") -3 ' Trims off the stuff you don't want at the bottom of the email.
if end_hook < 10 then end_hook = len(body)
body = left(body,end_hook)
body = Replace (body, "Sch. Dist.", "School District",1,-1,1)
hs.WriteLog "Ridgefield School Alert" , body
'Fill in whatever actions you want
'hs.speak "Email from Ridgefield Schools:" & body
end sub
CONST cEmailAddress = "info@flashalert.net" CONST cSearchString = "Ridgefield Sch. Dist" CONST sDebug = True sub main() index = hs.MailTrigger sMailFrom = hs.MailFrom(index) sSubject = hs.MailSubject(index) sBody = hs.MailText(index) sStatus = fParseMail(sMailFrom, sBody) hs.writelog "email_parser", sStatus end sub function fParseMail(sMailFrom, sBody) if lcase(sMailFrom) = lcase(cEmailAddress) then sStart= instr(1,lcase(sBody),lcase(cSearchString)) if sStart > 0 then sEnd = instr(sStart, lcase(sBody), "replies") if sDebug then hs.writelog "info", "sStart = " & sStart if sDebug then hs.writelog "info", "sEnd = " & sEnd sData = mid(lcase(sBody),sStart , sEnd - sStart) 'sEnd - sStart if sDebug then hs.writelog "info", "sData = " & sData fParseMail = "Success" hs.speak sData else fParseMail = "Failed" end if end if
Comment