+2 votes

I get "[alert] Please login via your web browser" error.

using (Imap imap = new Imap())
{
     imap.ConnectSSL("imap.gmail.com");
     imap.UseBestLogin("junaid21700@gmail.com", "xxx");

     imap.SelectInbox();

     List<long> uids = imap.Search(Flag.Unseen);
     foreach (long uid in uids)
     {
        var eml = imap.GetMessageByUID(uid);
        IMail mail = new MailBuilder().CreateFromEml(eml);

        Console.WriteLine(mail.Subject);
        Console.WriteLine(mail.Text);
     }
     imap.Close();
 }

I'm begginer please help what is the problem

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.

by (297k points)
edited by
...