+1 vote

An unhandled exception of type 'Limilabs.Client.IMAP.ImapResponseException' occurred in Mail.dll

Additional information: [ALERT] Please log in via your web browser: https://support.google.com/mail/accounts/answer/78754 (Failure)

 using (Imap imap = new Imap())
        {
            //Pass Host Name as string for connection
            imap.ConnectSSL("imap.gmail.com");

            //Pass Credential for Gmail account for Login Use Login() Method
            imap.UseBestLogin("abc@gmail.com", "XXXXXX");

            //Select Folder as of Now i am selecting Inbox Folder
            FolderStatus _folderStatus = imap.SelectInbox();

            //Find all Unseen Message Set to Flag Property
            List<long> uids =  imap.SearchFlag(Flag.Unseen);
            foreach (long uid in uids)
            {
                //Download Message Based On UID
                byte[] eml = imap.GetMessageByUID(uid);
                //Parse Download MEssage
                IMail imail = new MailBuilder().CreateFromEml(eml);
                Console.WriteLine(imail.Subject);
                Console.WriteLine(imail.TextDataString);
            }
            imap.Close();
by (450 points)
edited by

1 Answer

0 votes
 
Best answer

First log in to the specified account via the web browser, you might have received an email with the blocked attempt information. Review it - you might need to confirm it was you.

There are several ways of dealing with this error:

Please note that contrary to what the label says those applications (such as Thunderbird, Outlook and Mail.dll) are secure – they use TLS or SSL to secure the communication. The label name Gmail uses is misleading and false.

Here are more information on how to enable IMAP in Gmail.
https://www.limilabs.com/blog/enable-imap-in-gmail

by (297k points)
edited by
Yes I got mail as you told . And I set less Secure . but after that i am again getting this error
Use incognito mode for both captcha reset and less secure apps setting, so you are sure you are logged in to correct account
...