I'm trying to parse a .msg file. How do I get the conversation id?
I'm using org.apache.poi.hsmf.MAPIMessage
The structure of the MSG file format is described in the MSDN library, see [MS-OXMSG]: Outlook Item (.msg) File Format.
It is stored in the 0x0F030102 property - you can see if it is set in a particular MSG file in OutlookSpy (I am its author - click OpenIMsgOnIStg button).
Related
I am trying to read the HTML contents of a Document object(mail) as a part of my plug in development in Lotus Notes 9.
With this HTML content, we would like to create a file and send it as an attachment file in our query, so we can preserve the formatting, images, etc.
Even after session.setConvertMIME(false); I still do not get the Mime entity when I call doc.getMIMEEntity().
I have made preferences setting in Preferences>Mail>Internet
Internet mail format to "HTML and plain text".
I have tried doc.createMIMEEntity and then tried to retrieve it
mimePart = doc.getMIMEEntity("Body");
When i right clicked on Incoming mails from outlook I was able to see multiple Body items, one of which contained the HTML part.However I was still not able to access it via getMIMEEntity.
The mails I created from lotus notes, do not have multiple Body items. When I receive the mails from Lotus Notes > Outlook and I inspect source in Outlook, I see it as HTML. So I assume there is a place where this conversion takes place.
ShelfSession.getInstance().localSession.setConvertMime(false);
MIMEEntity nMime = (MIMEEntity) doc.getMIMEEntity("Body");
I want the Mime part to be set to this variable so I can retrieve the content to form the HTML file.
Please help with any code suggestions or is there some Lotus notes setting that I have missed out on that is making the Mime variable always null?
You said, "The mails I created from lotus notes, do not have multiple Body items." This almost certainly means the Body item is stored as rich text instead of MIME. You can confirm this by looking at the document properties in Notes.
You can use document.convertToMIME() to convert a Body item from Notes rich text to MIME. Here's an example:
MIMEEntity mimeEntity = null;
Item item = document.getFirstItem("Body");
if (item != null) {
if (item.getType() == Item.RICHTEXT) {
// Convert Notes rich text to MIME
document.convertToMIME(Document.CVT_RT_TO_PLAINTEXT_AND_HTML, 0);
}
mimeEntity = document.getMIMEEntity();
}
I've adapted this example from some code in MimeEntityHelper from the XPages Extension Library. I'd encourage you to take a look at that code for more context. For example, you still need to call session.setConvertMIME(false) to avoid converting a document that is already MIME to rich text. The MimeEntityHelper class uses both session.setConvertMIME() and document.convertToMIME() to control document conversions.
My requirement is search for a value (Message ID) in excel and take the other column values (Source and Target) of that row and form a XML.
Say my excel looks like below:
Message ID Output Source Target
#A74104I #A74104O IPT CRD
#A74101 #A74101 IAP CRD
#A74101 #A74101 IAP CRD
#A74104I #A74104O IAP CRD
For e.g. for message ID A74104I extract Source and target and form an XML as below. This messageID repeats and there are 2 source and target which are appended in same XML.
<ApplicationParameters>
<Parms name="default" type="default">
<SGHeader>
<ServiceName>
<TargetApplication>
<IAP>CRD</IAP>
<IPT>CRD</IPT>
</TargetApplication>
</ServiceName>
</SGHeader>
</Parms>
For each messageID create different XML.
If for a particular messageID Source repeats ( e.g. in above excel for A74101 Source IAP is the same) then put this messageID in an exception file which looks like<MessageID>
<A74101/>
</MessageID>
If you want to do it in Java, look here for code on how to parse Excel sheets.
Once that is done, you remain with extraction of MessageId from input file. You can do that in Java, using Regular Expressions. Look here or here for code on how to do it.
If you want to do it using powershell, look at this post. He has almost same requirement as you do (other than that he reads input from console).
You can search through rows/columns as shown in that post. Once a match is found, you extract relevant information and write-out the XML message to an external file.
Once you are able to do that, then you can worry about extracting MessageId from First Input File by coding it as shown in this post.
Does the procedure look like a good-fit for your need?
I am tried to display a message in java script using alert. It works
alert("User details saved successfully");
But, I need to display a custom message from a property file via the alert()
As you have tagged jsp in your problem, you can use a properties file to store all the messages and fetch the message from properties file and put it in the alert statement in javascript like this:
alert("<%=yourMessageToBeDisplayed %>");
Hope it helps!!
I'm using Apache James version 3.0-beta1 and I would like to know if there is a way to save separately the body of the e-mails from the attachments. Right now both of them are saved inside the DB, that leads to a noticeable increase in the table size due to the fact that all the attachments are saved inside the MAIL_BYTES column in the shape of a byte stream.
Is there a way to move outside the DB the attachments and leave inside the DB only the body of the emails? On the long run this default behaviour will make my DB collapse.
You may simply write a mailet to get the attachments of the mail and then save them to a specific folder in your filesystem. To be more specific, in mailet, get the MimeMessage from org.apache.mailet.Mail, then use it to check if there are any attachments by using getFileName() method. This method returns file names if Disposition and ContentType headers are not null . If the result is not null, then that means in than bodyPart you have a file attached.Then using getInputStream() you can save it to anywhere you want.
In SOAP Client application. I am using javax.xml.soap api. I am getting the soap response. A part of it, shown below.
<ns5:XXX type="Full" format="HTML">
<ns5:EmbeddedFile MIMEType="text/html"
fileExtension="html"
fileName="ZZZ.html">
<ns5:Document>...</ns5:Document>
</ns5:EmbeddedFile>
</ns5:XXX>
The value between the Document tag is in the Base64 format.
I need to know two things, as in the above code you will see that, the fileName is zzz.html.
where this zzz.html file will stored or exits. I search for in my local machine i do not find.
Another thing i would like to know that the between the Document tags it show long text messages in the Base64 format. Is this is the document that exists in the zzz.html. If it is so how to read that document.
Thanks
This appears to be a custom way of embedding file content to a SOAP message being used by the service you are calling - a standard way of doing this would have been using Soap Attachments.
In this specific case, it does look like the file content is being embedded as Base64 data between the Document tags, and the meta information of the file is the attributes of EmbeddedFile tag. You will basically have to decode the Base64 encoded content - see here
and here on how to, move the contents to a file with the name in the meta information tag.