3 Replies Latest reply on Mar 28, 2019 7:07 AM by eoinbyrne

    vRO Email Reading

    Bunty11 Enthusiast

      Can vRO monitor a Mailbox ?

       

      Can it read the email that are received on the mailbox ??

       

      And Based on Email Reading

       

      Can it initiates a workflow ?

        • 1. Re: vRO Email Reading
          eoinbyrne Expert

          Yes to all using the SMTP plugin.

          You can use a scheduled workflow to poll a mailbox via POP3 or IMAP

          You can retrieve email messages and extract the content

          You would need to write a parser of some kind to process the email content

          Once you have a parser you can trigger workflows to be executed based on the content

           

          I've done all of this before and it works fine

           

          -Eoin

          • 2. Re: vRO Email Reading
            MickeyO Lurker

            Hi Eoin,

             

            Do you have any code examples for parsing the emails?  Specifically I just want to filter on the subject and certain words in the content of the email reply.

            Thanks.

            • 3. Re: vRO Email Reading
              eoinbyrne Expert

              It depends on the format tbh. If you are just looking for keyword presence then you can do a lot with Regex matches or String.indexOf calls.

               

              E.g., if you wanted to check for the word Linux in the subject line you can do this

               

              var subjectContainsLinux = (mail.subject.indexOf("Linux") > -1)

               

              You can do similar things with the mail content depending on the format. If the mail content is a MultiPart and the MimeType is say "text/html" then you'd have to be able to parse the HTML to get the raw text or identify specific tags. If you google JS HTML parser you'd probably find examples around for free.

               

              In my case I had agreed a specific data exchange format with the client so emails that didn't meet the format criteria could be discarded. The format was similar to Java properties files but with definitive block start and end tokens (originally intended to permit multiple blocks in the mail body, e.g.,

               

              START-TOKEN

              propertyKey1=propertyValue

              propertyKey2=propertyValue

              END-TOKEN

               

              Anyway, HTH