Posted: 27 Oct 2015 14:58 EDT Last activity: 20 Dec 2015 22:24 EST
How to get MIME Object reference from Inbound email?
I have a requirement to upload inbound emails received by Pega to Documentum, conditionally based on the processing of email content. To achieve this i am trying to get MIME object reference of the inbound email.
There is already a service which will support the file upload process to documentum. So i just need to get the email file and pass the content to this service.
Thanks for the reply Jeff. Yes i want to get handle(object reference) of the email message. Goal is to send this email to documentam. if i can get the object reference of the email then will be able to get file content and details to send it to Service.
You can use the MimeMessage API as Jeff mentioned, specially you want to use getContent() which will return the content as Java object and then you can check its it of type string or else its multipart. Below is the sample code you can try:
As Jeff mentioned, if you have configured your Email listener to store the original email as attachment to your case, you already have the .eml file which you can send to your service. Doesn't this work? For some reason, if you want the email content as a MimeMessage object, you can see the example in this post to convert the .eml file into a MimeMessage object. http://stackoverflow.com/questions/2781739/loading-eml-files-into-javax-mail-messages