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

Free Support Forum - aspose.com

MailMessage Inbound/Outbound?

Hey guys,

In the class Aspose.Network.Mail.MailMessage, which properties can help you detect if the mailmessage is inbound or outbound?

Thnx in advance


Thank you for inquiry.

I am sorry there is no such property what directly tells whether a message is inbound or outbound.

Perhaps, you may detect by the recipient’s email addresses, if external address found then the mail is outbound. You may also check the Received header in MailMessage class. Each SMTP server that processes the message, adds it’s information, if there is some external mail servers information present, then message should be considered outbound.

MailMessage msg = MailMessage.Load(…); // load a message

My mistake, but we use MapiMessage.

The first idea won't work, if you send an internal message (same company).

How can you check this in Aspose.Network.Outlook.MapiMessage?

thnx in advance


Using MapiMessage, the message headers can be get with the below example:

MapiMessage mapiMsg = …; // load the messsage
Console.WriteLine("Message headers: " + mapiMsg.SubStorages[MapiPropertyTag.PR_TRANSPORT_MESSAGE_HEADERS]);