Is there already a script out that will parse through an incoming email and trigger event based on keywords? I use JON00's pop3 email checker and I know a subject line can trigger an event, But I need something that can trigger of the content of the email? Any Ideas?
Announcement
Collapse
No announcement yet.
Script to Parse Content on Email
Collapse
X
-
ppTags: None
-
A search turned up this thread that should get you started - http://board.homeseer.com/showthread.php?t=98346
Comment
-
pp
Hi I already had that. I have been in PM discussions with Rupp, Jon00, and MLOEBL they have been all very helpful. Right now I am trying to get it to parse usin Jon00's checkemail pop V3. His plugin is very nice and the scripting he setup already has alot of email checking features. Plus I like that it checks the server without relying on Outlook for email.
Comment
-
Here's a quicky that I just put together. Simply change the 2 CONST in the top to your email addy and event name and wait for an email.
' This script will access the email message that caused this event to trigger
' it will then run the event in the subject if the from address matches.
'
Code:CONST cEventName = "What is the date" CONST cEmailAddress = "yourEmailAddress.com" sub main() index = hs.MailTrigger sMailFrom = hs.MailFrom(index) sSubject = hs.MailSubject(index) sStatus = fParseMail(sMailFrom, sSubject) hs.writelog "email_parser", sStatus end sub function fParseMail(sMailFrom, sSubject) if lcase(sMailFrom) = lcase(cEmailAddress) then if instr(1,lcase(sSubject),lcase(cSearchString)) > 0 then fParseMail = "Success" hs.triggerEvent(cEventName) else fParseMail = "Failed" end if end if end function
-Rupp
sigpic
Comment
-
pp
-
pp
Ding Ding Ding We got a winner!
Seemed to work fine. GOing to try a few more but I think that's it..
Thank YOUUUUUUUUUUUUUUUUU!
Comment
-
pp
Spoke too soon. hehe
Strangest thing, once I triggered it once I can no longer get it too work. I didnt change the script setting and it will run the script with no errors but It always ends with a fail. I am going to delete and retry everything. Any thoughts?
Comment
-
pp
Where do I add the keyword to search with in the message body?
The word it will parse through in the message? Not the subject line.
' This script will access the email message that caused this event to trigger
' it will then run the event in the subject if the from address matches.
'
Code:CONST cEventName = "What is the date" CONST cEmailAddress = "yourEmailAddress.com" sub main() index = hs.MailTrigger sMailFrom = hs.MailFrom(index) sSubject = hs.MailSubject(index) sStatus = fParseMail(sMailFrom, sSubject) hs.writelog "email_parser", sStatus end sub function fParseMail(sMailFrom, sSubject) if lcase(sMailFrom) = lcase(cEmailAddress) then if instr(1,lcase(sSubject),lcase(cSearchString)) > 0 then fParseMail = "Success" hs.triggerEvent(cEventName) else fParseMail = "Failed" end if end if end function
Comment
-
pp
-
Try this. I didn't get to test it because I'm away from my pc.
Code:CONST cEventName = "What is the date" CONST cEmailAddress = "yourEmailAddress.com" CONST cSearchString = "This is a test" 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 if instr(1,lcase(sBody),lcase(cSearchString)) > 0 then fParseMail = "Success" hs.triggerEvent(cEventName) else fParseMail = "Failed" end if end if end function
Last edited by Rupp; December 18, 2006, 12:47 PM.-Rupp
sigpic
Comment
-
pp
Comment