3 Replies Latest reply on Jan 13, 2012 11:50 AM by Richard De Vries

    how to determine whether the pop adapter inputevent is an html format email

      Share This:

      I have created a pop adapter monitor and some rule and this works ok.  My next step was to build a process that rejected email that is sent in plain text.  In my process i create a switch and logica along the lines of if //bodypart contains string html then exit with an error.  However the contents of the //bodypart appear to be treated as xml and i am not sure how to deal with that.  Does anyone have any ideas  here are two examples of the input event.  the bottom one is comes from a plain text email the top one from an html formated email.

       

      inputevent (using html formated email)

       

      <adapter-event>

        <source-adapter>POP Adapter</source-adapter>

        <event>Email received</event>

        <data>

          <email-message>

            <from>

              <email-address>me@mycompany.com</email-address>

            </from>

            <sent-date>Thu Jan 12 10:20:54 PST 2012</sent-date>

            <sent-epoch-milliseconds>1326392454000</sent-epoch-milliseconds>

            <reply-to>

              <email-address>me@mycompany.com</email-address>

            </reply-to>

            <recipients>

              <email-address>baorcvr@mycompany.com</email-address>

            </recipients>

            <subject>test in html</subject>

            <body>

              <bodypart>&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif; "&gt;&lt;div&gt;Line 1&lt;/div&gt;&lt;div&gt;Line 2&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;/body&gt;&lt;/html&gt;&#xD;

      </bodypart>

            </body>

          </email-message>

        </data>

      </adapter-event>

       

       

       

      inputevent (plain text)

       

      <adapter-event>

                <source-adapter>POP Adapter</source-adapter>

                <event>Email received</event>

                <data>

                          <email-message>

                                    <from>

                                              <email-address>me@mycompany.com</email-address>

                                    </from>

                                    <sent-date>Wed Jan 11 14:51:10 PST 2012</sent-date>

                                    <sent-epoch-milliseconds>1326322270000</sent-epoch-milliseconds>

                                    <reply-to>

                                              <email-address>me@mycompany.com</email-address>

                                    </reply-to>

                                    <recipients>

                                              <email-address>baorcvr@mycompany.com</email-address>

                                    </recipients>

                                    <subject>test email in plain text</subject>

                                    <body>

                                              <bodypart>Line 1

      Line 2

       

       

      </bodypart>

                                    </body>

                          </email-message>

                </data>

      </adapter-event>