Announcement

Collapse
No announcement yet.

How to trigger an event based on the subject or body of an email

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to trigger an event based on the subject or body of an email

    PHP Code:
    ' this script will access the last received email
    '
    sub main()

    dim index,position
    dim EmailSubject
    ,EmailFrom,EmailBody

        index 
    hs.MailTrigger
        EmailSubject 
    hs.MailSubject(index)
        
    EmailFrom lcase(hs.MailFrom(index))
        
    EmailBody hs.MailText(index)

    position Instr(lcase(EmailSubject),"insert special subject here - all lower case"

    if 
    position<>0 then

        hs
    .writelog "EMAIL","Special Email received from " EmailFrom
        hs
    .writelog "EMAIL","The content was: " EmailBody

    end 
    if

    end sub 
    Add an event that triggers on email received and set it so that it runs this script as an action.

    Just an alternative!

    Code dontated by Mitch
    -Rupp
    sigpic
Working...
X