Lucee 7 POI msg possible?

Heya everyone!

It’s been a long time since I’ve been on this forum. But I hope someone here can help me with some problems I encountered when upgrading our old Lucee instance to the new Lucee 7.

I had some code that reads a MSG file and extract some meta-data, body and attachments. I remember years back I had all the jar files that are needed, but these don’t seem to work anymore.

It’s understandable that POI is a large library and give a lot of dependencies problems but I hope there is a workaround possible.

I tried these newer JAR files:
Screenshot 2025-11-29 114829

but then I get a “No Bundle provided” error. I have placed them in “C:\lucee\tomcat\lucee-server\context\lib”

I am trying to call the following code btw:
msg = createObject("java", "org.apache.poi.hsmf.MAPIMessage");

I tried to use the POI library in the cfspreadsheet library but the HSMF portion doesn’t exists.

Main question
Is it possible to use this route to read a MSG with POI or is this a lost cause?

I tried looking for some external CLI tool that I can use to convert a MSG to EML but that’s also a niche market. Also saw that you can use Maven dependencies inside a component but it will probably fail on POI conflict. I just hope I can load these jar files in their own scope just to read the MSG file but I don’t know if that’s possible.

Thanks in advance!

It looks like the only POI jar required is the “scratchpad”. This is working for me on Lucee 7.0.0.395:

// inline component to save creating a separate cfc
msg = new component javaSettings='{"maven":["org.apache.poi:poi-scratchpad:5.5.0"]}'{

  import "org.apache.poi.hsmf.MAPIMessage"

  property name="message";

  void function loadMessage( required path ){
     variables.message = New MAPIMessage( arguments.path )
  }

  string function getRecipientEmailAddress(){
    return variables.message.getRecipientEmailAddress()
  }

}
path = ExpandPath( "sample.msg" )
msg.loadMessage( path )
recipient = msg.getRecipientEmailAddress()
dump( recipient )

Screenshot 2025-11-29 at 12-31-41

2 Likes

Great example

I’ve made the java settings a bit more robust in 7.0.1 in terms of handling errors

Java settings json are validated as valid json at compile time (downloaded and and evaluation at runtime)

https://luceeserver.atlassian.net/browse/LDEV-5927

Java settings need to be json, if you tried a cfml struct the result was confusing, no functions!

https://luceeserver.atlassian.net/browse/LDEV-5763

Inline components had wrong stack traces

https://luceeserver.atlassian.net/browse/LDEV-5883

Hopefully this makes the development experience better for everyone!

3 Likes