public class MissingSequence {
public static void main(String[] args) throws SQLException, ClassNotFoundException{
File folder = new File("C:\\Lap_C_Drive\\APOSEMAILS\\");
File[] listOfFiles = folder.listFiles();
for (int i = 0; i < listOfFiles.length; i++) {
if (listOfFiles[i].isFile()) {
System.out.println("File " + listOfFiles[i].getName());
try
{
MapiMessage outlookMessageFile=MapiMessage.fromFile(folder + listOfFiles[i].getName());
System.out.println("OutlookMessageFile::: " + outlookMessageFile);
//Display sender's name
System.out.println("Sender Name : " + outlookMessageFile.getSenderName());
//Display Subject
System.out.println("Subject : " + outlookMessageFile.getSubject());
//Display Body
System.out.println("Body : " + outlookMessageFile.getBody());
//Display Recipient's info
System.out.println("\nRecipients : \n");
//Loop through the recipients collection associated with the MapiMessage object
for (int j=0; j<outlookMessageFile.getRecipients().size(); j++)
{
//Set a reference to the MapiRecipient object
MapiRecipient rcp= (MapiRecipient) outlookMessageFile.getRecipients().get_Item(j);
//Display recipient email address
System.out.println("Email : " + rcp.getEmailAddress());
//Display recipient name
System.out.println("Name : " + rcp.getDisplayName());
//Display recipient type
System.out.println("Recipient Type : " + rcp.getRecipientType());
}
}
catch(Exception ex)
{
System.out.println("Some error occurred while parsing the msg file.");
}
}
}
}
***************************************
Output is **********
run:
File Message.msg
OutlookMessageFile::: com.aspose.email.MapiMessage@18bbc5a
Sender Name : Atul Singh
Subject : New message created by Aspose.Email for Java(Aspose.Email Evaluation)
Body : This is an evaluation copy of Aspose.Email for Java
View EULA Online: http://www.aspose.com/corporate/purchase/end-user-license-agreement.aspx
------------------------------
This line is in bold.
This line is in blue color
Recipients :
Email : atul.bhadauria@xchanging.com
Name : Atul Singh
Recipient Type : 1
Email : atuls.work@gmail.com
Name : ATUL2
Recipient Type : 1
File Missing Sequence - 132698.msg
Some error occurred while parsing the msg file.
BUILD SUCCESSFUL (total time: 3 seconds)
//***************
Can you please help and suggest a possible solution.
Regards
Atul Singh