Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

using coldfusion + javamail to read .eml file and show image attachments

843834Feb 5 2008 — edited Feb 5 2008
I'm trying read a .eml and then display attachments in this file using Javamail and Coldfusion.
Here's some of my code:
<cffunction name="init" output="true">
<cfargument name="filename" required="true">
<cfset variables.emlFilenameandPath = "D:\site\Dev\test\#arguments.filename#" />
<cfset variables.oProps = createObject("Java", "java.util.Properties")>
<cfset variables.oProps.init()>
<cfset variables.temp = oProps.put("mail.host", "smtp.test.com")>
<cfset variables.temp2 = oProps.put("mail.transport.protocol", "smtp")>
<cfset variables.mSession = createObject("Java", "javax.mail.Session")>
<cfset variables.objSession = mSession.getInstance(oProps)>
<cfset variables.FileInputStream = CreateObject("Java", "java.io.FileInputStream") />
<cfset variables.FileInputStream.init("#emlFilenameandPath#") />
<cfset variables.oMail = createObject("Java", "javax.mail.internet.MimeMessage").init(objSession,FileInputStream)>
<cfreturn this/>
</cffunction>

<cffunction name="getAttachments" output="true">
<cfset content = oMail.getContent()>

Where I need to go from here, I'm not sure. It looks like the getBodyPart and getContentType and getFileName functions might be what I need, but I'm not sure and I'm having a lot of trouble using these functions without Coldfusion telling me these functions don't exist. Anyone else done something like this with Javamail and Coldfusion?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 4 2008
Added on Feb 5 2008
0 comments
443 views