We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to get MimeContent from mail using aspose.email for java

Hello Team,


I am evaluating yours aspose.email for java as jar file.But i did not getting Mime content.Please help me.

Hi Ajinath,


Thank you for writing to Aspose Support team.

Please share your sample message file and code sample with us that you are trying at your end for our reference. We’ll look into it for assisting you further.
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; color: #3933ff} span.s1 {color: #000000} span.s2 {color: #931a68}

This is source code->


File emlFileDirectory = new File("/Users/UserName/Desktop/EMLSource");


p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco}

File[] emlFilePathArray = emlFileDirectory.listFiles();


p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; color: #3933ff} span.s1 {color: #000000}

String dst = "/Users/UserName/Desktop/" + "User_Sample.pst";


p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco} span.s1 {color: #931a68}

File f_StrFileName = new File(dst);


p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco} span.s1 {color: #931a68}

if(f_StrFileName.exists())

{

f_StrFileName.delete();

}


p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco} span.s1 {color: #0326cc}

PersonalStorage pst = PersonalStorage.create(dst,FileFormatVersion.Unicode);


p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco} span.s1 {color: #3933ff} span.s2 {color: #0326cc}

FolderInfo inboxFolder = pst.createPredefinedFolder("Inbox", StandardIpmFolder.Inbox);


p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco} span.s1 {color: #931a68}

for(File emlFile:emlFilePathArray)

{

msg = MailMessage.load(emlFile.getAbsolutePath());


MapiMessage message = null;


if(msg != null)

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco} p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; min-height: 15.0px} span.s1 {color: #931a68} span.s2 {text-decoration: underline} span.Apple-tab-span {white-space:pre}

{

message= MapiMessage.fromMailMessage(msg);

}


if(message != null)

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco} span.s1 {color: #931a68} span.Apple-tab-span {white-space:pre}

{

inboxFolder.addMessage(message);

}



p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco} span.s1 {color: #931a68} p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco}

}



p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco}

Hi Ajinath,


As shared earlier, please share your sample EML/MSG/PST file from which you are not able to retrieve the mime contents. We’ll look into it for assisting you further.