Jump to content

using 360Works Email plugin to parse inbound HTML email

Recommended Posts

We have a client that is sending email to us from their ServiceDesk help desk system.  The issue is that the email is laced with HTML tags, so much so that the 360Works Email plugin script step to read the email doesn't find any body to insert in a FileMaker field.  The script step is of the form:

Set Field[ImportedMessage::body ; EmailReadMessageValue( "body" )]

The field ImportedMessage::body is empty, even though we know there is content because a cc copy of the same email can be read, for example, by Apple Mail.  Any ideas how to parse the content out of an email that a bunch of HTML junk embedded throughout the body of the email?

Link to post
Share on other sites



EmailReadMessageValue("body") is the equivalent to the documented value "text" so passing in that value will only return the plaintext version of an email, if one is available. I suspect since you are getting a blank result then the email you are parsing does not have a plain text body version. I think you will get better results by using one of the following values:


"html" (The HTML body part, if one is available. If attachments are set to download, inline attachment images will be converted to base64 data URLs automatically. If you don't want this behavior, use htmlRaw instead, or set attachments=false when fetching messages.)

"htmlRaw" (The HTML body part unaltered, if one is available.)


Link to post
Share on other sites

Thanks very much, Ryan.  I'll give that a try.  I think you are correct:  these emails must contain HTML exclusively.

A few questions, however:  it is very possible that inline attachments will be included in emails that are processed this way and it is likely we will also receive plain text emails.  If I switch from "body" to "html" ...

  1. Will plain text emails still have their contents inserted into a FileMaker text field as before?
  2. Will attachments at the end of emails still be able to be downloaded and placed in container fields in FileMaker the same way?
  3. Will attachments that are inline (with possible images that, as you say, will be converted to base 64) still be able to be downloaded and placed in container fields in FileMaker the same way?  (Will converting to base 64 make a difference in how the container field is able to display its contents?)




Link to post
Share on other sites

Hi Martin,

1. For emails that only contain plaintext and no html counterpart, you will probably see the same behavior you were seeing with "body" and emails with only an HTML body, an empty result.  To make the script dynamic, I would recommend that you have a field for plain text content and a field for HTML and then call EmailReadMessageValue with both "text"(or "body") and "html". 

2. Yes

3. You should still be able to parse inline attachments the same way. This just gets the base64 representation of the inline attachment and puts it in HTML being requested, it doesn't convert the actual inline attachment file that gets downloaded with EmailReadMessages. 


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Similar Content

    • By 360Works
      Email, Scribe, and FTPeek FileMaker Plugins Have New Updated Versions with Improvements
      Learn about the new updates available and download now!
      Last week we were excited to announce that all of our plugins are compatible with the new FileMaker 19 platform!

      This week, we have additional feature enhancements and improvements specific to three of our most popular plugins: 360Works Email, Scribe, and FTPeek.

      While these are minor updates, we encourage you to update now for the best experience using each plugin.
      Download new plugin versions and check out the latest improvements using the links below!
      360Works Email Plugin (Version: 3.316) - FileMaker plugin for sending and receiving emails using IMAP, SMTP, or POP, plus adds sending SMS/Text Messages from FileMaker capabilities.
      Added "attachmentsDir" parameter to EmailReadMessages, allowing users to specify a local directory where they want attachments downloaded. Downloaded attachments are now deleted when EmailDisconnect is called. Implemented a fix for some rare DHC issues that were occurring. Improved inline attachments in emails for better downloading. Reworked the "secureconnection" parameter. SecureConnection will now set both ssl and tls to true. However these can be set individually with "ssl=true" or "tls=true". This resolves issues with certain mail servers that require tls, but reject ssl. IMAP servers better retrieve the messageId and better loading of body structure in messages. 360Works Scribe Plugin - (Version: 4.0710) - FileMaker PDF plugin, OCR plugin, Microsoft Word and Excel integration - all in one.
      Improved how keywords are being pulled from PDFs. Improved Windows file-locking, temporary files are now deleted when ScribeDocCancel is called. Better conversion of Excel files to text with merged cells. Improved Textract results downloads for better accuracy. Improved inserting images into Excel documents. 360Works FTPeek Plugin - (Version 2.305) - FileMaker plugin that can upload, download, and manipulate remote files on an FTP (File Transfer Protocol) server.
      Updated FTP libraries, resolving some connection issues. Reworked the Forcetrust parameter on FTPeek_ConnectFTPS. It should now accept most invalid certificates.
      Interested in Three or ALL Plugins from 360Works?
      Get the BEST DEAL with the Portfolio Bundle.
          Stay updated with 360Works
    • By Oyseka
      Good day all, I have a script that collects several reports from different tables and assembles them to email via the following code. How do I clear all the reports after the reports have been sent,(or before the next set of reports are compiled).
      Set Variable [ $Path; Value:Get (TemporaryPath) &"Products Active" & " " & Year ( JobCardItems::DateNextServ )& "-" & Month ( JobCardItems::DateNextServ ) & ".pdf" ]
      Save Records as PDF [ File Name: “$Path”; Create folders:No; Records being browsed ]
      [ Document - ]
      [ Pages - Number Pages From: 1; Include: All pages ]
      [ Security - Printing: High Resolution; Editing: Any except extracting pages; Enable copying; Enable Screen Reader ] [ Initial View - Show: Pages Panel and Page; Page Layout: Single Page; Magnification: 100% ]
      [ Restore; No dialog ]
      Set Variable [ $AttachmentList; Value:If ( IsEmpty ( $AttachmentList ) ; $Path ; $AttachmentList & "¶" & $Path) ]
      I have tried just setting the variable $Path; Value: "" but that did not work
    • By St3v1e
      As a complete novice to FMP, I'm attempting my very first database. We rely on storing our contracts on Google & Dropbox. I've been trying to either embed the pdf's into a "tab", or (my preferred option) to have an "Add URL" button to link to the online pdf.
      I tried adding a field and copying and pasting the URL, but it's not clickable, and I'd need to add another field for each pdf/contract.
      Is there a better more efficient way to do this?
    • By mvoogt
      I have started sending emails using the INSERT FROM URL method shown by soliant here:
      Emails are being sent out but many recipients seem to be getting my emails sent to their spam folders. I'm curious if this has anything to do with this method of sending emails.
    • By DataCruncher
      This is driving me nuts. 
      Need to send emails with an attachment from server side script. 
      The attachment path calculates correctly, as far as I can tell. Permissions are 777 (I Know...), but the file still does not attach!
      This is the variable calculation that yields the path: 
      "/Samsung SSD/Library/FileMaker Server/Data/Documents/"&$filename
      Only problem is: attachments don't attach!
      I have tried every iteration I could think of: 
      "filemac:/Samsung SSD/Library/FileMaker Server/Data/Documents/"&$filename
      What am I missing here???
      Thank you!! I can't believe I'm the only one who ran into this issue?
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.