Is there a way to delete all of unread yahoo emails (>110k) without scrolling down? It seems none of How can I select all unread messages on the new version of Yahoo Mail? works.

  • 2
    Does this answer your question? How can I select all unread messages on the new version of Yahoo Mail?
    – Kos
    Jun 26, 2020 at 21:44
  • None of these answers worked for me, I had to scroll down and it is really inconvenient. I cannot post my answer there as my reputation is low, so I created a Thanks for the link, another question, as the only solution that I could have think of, but I also believe that this post (mine) can be deleted and the answer must be moved to the link you have provided (but not sure how I can do it) Jun 27, 2020 at 0:10

1 Answer 1


It seems the only way is doing it through coding.I confess this is not a perfect solution and am still looking for better answers. I selected C# and have to use IMAP. IMAP is a protocol for working with emails through coding. The other one is POP3 but it does not have an attribute to see if a message has been seen (read) or not (unread).


1-I had to install Visual Studio and create a C# application.

2- Download MailKit by going to Tools->NuGet packet manager->Manage NuGet packages for Solution->Select MailKit and install as shown below. enter image description here

enter image description here

3- Create an app password in Yahoo for this tool (I called it IMAP just for the sake of naming) as it asks for a name. enter image description here

4- Then writing the below code in c#

        using System;
    using MailKit;
    using MailKit.Search;
    using MailKit.Net.Imap;
    using MailKit.Security;
    using System.Threading;

    namespace ConsoleApp1
        class Program
            static void Main(string[] args)

                using (var client = new ImapClient())
                    int j = 1;
                   l1: client.Connect("imap.mail.yahoo.com", 993, SecureSocketOptions.SslOnConnect);

                    // Note: use your real username/password here...
                    client.Authenticate("Your yahoo email address", "PP password you generated earlier in Step 3");
                        // open the Inbox folder...

                        //search unread messages 
                        var uids = client.Inbox.Search(SearchQuery.NotSeen);

                        Console.WriteLine("You have {0} unread message(s).", uids.Count);
                        for (int i = 0; i < uids.Count-30; i++) //This keeps your last 30 messages (if you recive more than 30 message during the deletion process then you need to increase this)
                            var uids1 = uids[i];

                            client.Inbox.AddFlags(new UniqueId[] { uids[i] }, MessageFlags.Deleted, true);
                            Console.WriteLine("You have {0} unread message(s).", uids.Count - i);
                            if (j % 500 == 0)// I think this is required as this solves the problem of being loged out by IMAP server
                                goto l1;

                    catch (Exception e)
// sometime IMAP throw an error regarding the search query, maybe a bug, this solves it
                        goto l1;

and the output:

enter image description here

It took me about 17 hrs to delete my unread messages

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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