T
T
Troodi Larson2018-08-03 12:06:32
Email
Troodi Larson, 2018-08-03 12:06:32

What is the name of the Spam folder when connected via IMAP?

It's easy to get inboxes: emailList = mailRepository.GetAllMails("inbox");
But in spam it doesn't work anymore, it doesn't find the folder. Yandex mail. I connect via IMAP.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
lvv85, 2018-08-03
@troodi

mailkit

using System;

using MailKit.Net.Imap;
using MailKit;

namespace MailKit_app
{
    class Program
    {
        static void Main(string[] args)
        {
            using (var client = new ImapClient())
            {
                client.ServerCertificateValidationCallback = (s, c, h, e) => true;

                client.Connect("imap.yandex.ru", 993, true);

                client.Authenticate("[email protected]", "password");

                var junk = client.GetFolder(SpecialFolder.Junk);
                junk.Open(FolderAccess.ReadOnly);

                Console.WriteLine("Total messages: {0}", junk.Count);
                Console.WriteLine("Recent messages: {0}", junk.Recent);

                for (int i = 0; i < junk.Count; i++)
                {
                    var message = junk.GetMessage(i);
                    Console.WriteLine("Subject: {0}", message.Subject);
                }

                client.Disconnect(true);
            }
        }
    }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question