Reputation: 45
I want to search and delete messages with ActiveUp.Net.Mail
library on IMAP4 service. I don't know how to get UID from ActiveUp.Net.Mail.Message
or how to search mailbox with selected folder if I know MessageId.
Of course I have previously fetched messages so I know its MessageId
.
Best Regards.
Upvotes: 1
Views: 2919
Reputation: 120
I know it's too late but I faced the same problem today so, maybe there are other people still looking for the answer. Here is the solution that worked for me:
// Select the Mailbox you want to query
Mailbox Inbox = _client.SelectMailbox("Inbox");
for (int x=Inbox.MessageCount; x>0; x--)
{
Message email = Inbox.Fetch.MessageObject(x);
ProcessEmail(email, x);
}
Basically the messageOrdinal is the index of the mail (for example: the position in the gmail Inbox), but you have to keep the reference by yourself because ActiveUp.Net.Mail.Message won't provide any function to retrieve it.
In the ProcessEmail
function you will receive the messageOrdinal
as input parameter:
public void ProcessEmail(Message email, int messageOrdinal)
{
//...
}
Upvotes: 1