Anderson Rissardi
Anderson Rissardi

Reputation: 2547

How to compare e-mail messages without using the body of the message?

How to compare e-mail messages without using the body of the message?

For example:


How to identify that the message that Mary received is the same as the message that John sent("save") without using the body of the message?

Currently this is working as follows, a HASH is made with the following information:

This Hash is stored in the database, when Mary's Outlook triggers the event of the new message, a HASH with the same information is generated and compared in the database to see if it should be categorized or not.

The problem is that depending on the body size of the message, it is not performatic, it takes a long time to get the body of the message through the MailItem.Body property.

The purpose of not using the body of the message is solely to increase performance.

public string GetAssinatura(Outlook.MailItem email)
    {
        try
        {

            string corpoEmail = email.Body;//this is not performatic with big messages

            var hash = GenerateHash(corpoEmail); 
        }
    }

Conversation participants can reply or forward the message, so Outlook and most of the most frequently used e-mail clients change the subject to a default, Re: Subject for example. Therefore, it is not possible to only have a hash of the participants and the subject.

Upvotes: 1

Views: 282

Answers (1)

Anderson Rissardi
Anderson Rissardi

Reputation: 2547

Using the property:

MailItem.SentOn

It's possible generate that hash. The sender Outlook only will have that info after send the message. So the code must run when a new item is add in the Item_Send folder.

Upvotes: 2

Related Questions