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

Free Support Forum - aspose.com

How to differentiate between emails sent and received

Dear Aspose users and technical support.

I wonder if there is any way to obtaining from an object type Mailinfo or MailMessage, whether it is e-mail is received or sent.

For example:

foreach (MessageInfo messageInfo in messageInfoCollection)
{
MapiMessage msg = pst.ExtractMessage(messageInfo);
if (msg.isSent())
{

}
}

A greeting.

Hi Alejandro,


Thank you for using Aspose.Email.

After analyzing your requirements, I investigated the possibility of message type differentiation by testing different emails from my inbox and Sent items. After analyzing messages properties using Outlook Spy, I was able to observe that all the received messages has PR_RECEIVED_BY_ENTRYID property, where this is missing in case of Sent messages. Therefore, the type of message can be identified using this property as follow. Please try it at your end and let us know your feedback.


MapiMessage mapi = MapiMessage.FromFile(“SampleMsg.msg”);


if (mapi.Properties.Contains(MapiPropertyTag.PR_RECEIVED_BY_ENTRYID))

Console.WriteLine(“This message is a Received message.”);

else

Console.WriteLine(“This message is a Sent message.”);

It works fine.

Now I can order my pst emails by my own criteria.

Thank you so much

Hi,


Thank you for the feedback and please feel free to contact us if you have any additional query/inquiry realted to Aspose.Email.