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

Free Support Forum - aspose.com

How to get or set read/unread flag in mails using aspose.email for java

Hello Team,


I have problem with getting read and unread flags from mails. I have tried using below code but did not getting properly.

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; color: #4e9072} span.s1 {text-decoration: underline}

boolean isread = (message.getFlags() & MapiMessageFlags.MSGFLAG_READ) == MapiMessageFlags.MSGFLAG_READ;




I have to create PST from MBOX file. while reading MBOX file unable to get read/unread mails flag


Please help me!

Hi,


Thank you for writing to Aspose Support team.

We have investigated the issue at our end by reading a MSG file and testing with the sample code below, but no such issue was found. It shows the information correctly. Could you please try it at your end and let us know with the latest version of the API?

Sample Code:

<pre style=“background-color: rgb(255, 255, 255); font-family: “Courier New”; font-size: 9pt;”>MapiMessage message = MapiMessage.fromMailMessage(“1.msg”);

boolean isread = (message.getFlags() & MapiMessageFlags.MSGFLAG_READ) == MapiMessageFlags.MSGFLAG_READ;

System.out.println(isread);

Please read EML File and convert put into PST file.


This is my sample code :-

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} p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; color: #4e9072} span.s1 {color: #931a68} span.s2 {text-decoration: underline} span.s3 {color: #0326cc} span.Apple-tab-span {white-space:pre}

for(File emlFile:emlFilePathArray)

{

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

MapiMessage message = null;

if(msg != null)

message= MapiMessage.fromMailMessage(msg,MapiConversionOptions.getUnicodeFormat());

boolean isread = (message.getFlags() & MapiMessageFlags.MSGFLAG_READ) == MapiMessageFlags.MSGFLAG_READ;


// MailPriority f_Priority = msg.getPriority();

if(message != null)

inboxFolder.addMessage(message);

}

I have tried your latest version aspose.email for java 16.12.0.But still have same problem

Hi,


Please share your sample EML/MSG file and complete sample code with us as we are not able to reproduce the problem at our end using our sample files. We’ll look into it for assisting you further.

Hello,


I have added a MBOX sample in zip format. Please open this sample on Mac OS X.Then you can try to get mails read and unread flags. In this sample all mails having a unread flag.

Hi,


Could you please share the steps to open this file in Mac OS X? Also, are you setting the flags or reading the flags from the message in MBox file. Please share detailed scenario that you are executing at your end.