Reputation: 85
I have an email with yahoo business and MailKit works with POP. I want to download the message after finding a specific subject. Or could I use IMAP?
Upvotes: 2
Views: 3893
Reputation: 38528
If the POP3 server supports the TOP
extension, you can download just the message headers to first check the subject. To do that, you could do something like this:
if (client.Capabilities.HasFlag (Pop3Capabilities.Top)) {
var headers = client.GetMessageHeaders (index);
if (headers[HeaderId.Subject] == subject)
message = client.GetMessage (index);
}
If your Yahoo account also supports IMAP, I would recommend using IMAP since IMAP allows you to query the server for messages with a given subject which is much more efficient than downloading the headers for every message to check if the subject matches the one you are looking for.
Upvotes: 1