Saubs Posted July 6, 2012 Posted July 6, 2012 Hello all, Am evaluating the plug-in for possible purchase (Enterprise license). I need to import sent messages from a mailbox into an FM table every morning. Works well, except that inline images are not showing up in the FM WebViewer; I get blue/white 'image missing' question mark icons where the images should be. Here's a code fragment: EmailReadMessages ( "progress=true" ; "mailbox=Sent Messages" ; "attachments=true" ; "skip=" & ema_PRF__kx::skip ; "readonly=false" ; ) Do I also need to call EmailAttachFileInline? I'm not composing a new html message, I'm just reading/importing existing messages that have already been sent by my users (via their Apple Mail app) so I'm not sure if EmailAttachFileInline is the way to go in this scenario. Any suggestions greatly appreciated! Many thanks--
Newbies Tobias Liebhart Posted July 9, 2012 Newbies Posted July 9, 2012 I solved this by parsing the Mail for inline image tags and replacing them with a base64 encoded version of the image (using ScriptMaster for Base64 encoding). Takes a bit more space but works fine. You just can't send it back to Outlook (2007+) clients as DataURIs are not supported there.
Saubs Posted July 9, 2012 Author Posted July 9, 2012 I can get an attachment (a small jpeg) from a sent email into a container field. And the html has been read into a text field. But I can't figure out how to make that jpeg appear as an inline graphic in the webviewer. I guess conceptually I'm looking for a way to change src="cid:F119C926-4C71-4558-8005-83E1BF95D671" to src="cid:<the file in the container field"> but obviously html doesn't recognize FM tables & fields. How is it done? Many thanks--
Newbies Tobias Liebhart Posted July 10, 2012 Newbies Posted July 10, 2012 Download Scriptmaster. Create the following Function: Function Name:ContainerToBase64 Parameter:fieldName Function: return new sun.misc.BASE64Encoder().encode( fmpro.getContainerStream( fieldName ).getBytes() ); Then use this function to create a Base64 representation from your Container Field Image. It will look something like this: /9j/4QZKRXhpZgAATU0AKgAAAAgADAEAAAMAAAABAJIAAAEBAAMAAAABANkAAAECAAMAAAADAAAA ngEGAAMAAAABAAIAAA... Replace the "¶” characters with "" Parse the email and replace every image with its Container field representation Replace: <img src="cid:F119C926-4C71-4558-8005-83E1BF95D671"> with: <img src="data:image/png;base64,/9j/4QZKRXhpZgAATU0AKgAAAAgADAEAAA..."> and adapt the image MIME type from image/png to image/jpeg for a jpeg image
Recommended Posts
This topic is 4518 days old. Please don't post here. Open a new topic instead.
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 accountSign in
Already have an account? Sign in here.
Sign In Now