Reputation: 75
I am using mail kit to send receive mail, and manage all records in my database. I am storing all user action for particular mail and then execute it using my code. I am storing message id in the table for the unique message, now I want to get the message using messageid. Is there any way to do it?
Upvotes: 5
Views: 4731
Reputation: 38528
Firstly, don't expect the Message-Id header to be globally unique. Any hacker could easily create their own message and re-use a known Message-Id to try and confuse software that depends on Message-Ids being unique.
That said, you'll need to use the IMailFolder.Search()
API combined with SearchQuery.HeaderContains()
to search for messages with a particular Message-Id header.
var uids = folder.Search (SearchQuery.HeaderContains ("Message-Id", "[email protected]"));
Upvotes: 7