how can i search contents of Email??


how can i search contents of Email?


my code 


                Imap client = new Imap();
                client.Connect(_ServerName, _port, _securityMode);
                client.Authenticate(_seletedUserName, _seletedPassword);
// I want to sarch "test" Keyword on Mail server
                ImapCriterion criteria = ImapCriterion.Keyword("test");
                ImapMessageCollection listMessages = client.ListMessages(ImapEnvelopeParts.UniqueId | ImapEnvelopeParts.Size, criteria);
It does not work well.


edited 12/2/2017 7:28:25 PM
asked 3/7/2017 4:45:49 AM
add a comment

1 Answers


Sorry for the late reply. You are missing the Body field. Please see the code below:

ImapMessageCollection listMessages = sys.ListMessages(ImapEnvelopeParts.UniqueId | ImapEnvelopeParts.Size | ImapEnvelopeParts.Body, ImapCriterion.Keyword("test"));

answered 11/16/2017 12:41:37 AM
add a comment

Your Answer

Not the answer you're looking for? Browse other questions tagged mail or ask your own question.