In this article I will explain how to resolve the error: The server did not respond with a +OK response. The response was: "-ERR [AUTH] Application-specific password required" in ASP.Net Application when trying to access Gmail Mailbox using POP3.
The following error occurs when you try to access Gmail Mailbox using your Gmail credentials in your ASP.Net application.
Following are the possible solutions in order to resolve the error.
1. Incorrect Gmail Username and/or password
First you must check whether the Username and Password supplied are correct.
Though Gmail allows you to sign in with Username instead complete Email but when accessing Gmail Mailbox through code you need to pass the complete Email address as Username.
2. SSL setting
Gmail uses secure channel and hence you need to enable SSL security while accessing Gmail Mailbox through your application.
Gmail POP3 access requires SSL to be set to True and the Port No is 995.
3. Less Secure Apps setting
If you are sure that your Username and Password are correct, but you are still getting errors then it means that Gmail has blocked your application.
And in such case, you will receive an email similar to what is shown below.
Note: If you have not received any email, then use the following link to enable Less Secure Apps setting.
Once you visit the link, you need to modify the Less Secure Apps setting and Turn On access to Less Secure Apps as shown below.
4. Two Step Authentication
If Two Step Authentication is enabled for your Gmail Account, then the Less Secure Apps settings will not be available and you won’t be able to access Gmail Mailbox using your Gmail Password.
Thus, in such scenario, you will need to generate App Password for your Gmail Account using the following link.
1. You will see the following page.
2. Select Other option in App DropDownList.
3. Give the App, a suitable name and click the Generate Button.
4. Once generated, copy and save the Password (in Yellow Box) somewhere and click Done.
5. The App will be visible, but its Password will not be visible again. If you ever forget the Password, delete the App and create a new one.
5. Application Location
If the solutions #1, #2, #3 and #4 are not working for you then it might be the issue with the location of the Application accessing the Gmail account.
Gmail makes sure that your account is not being accessed from some other Country or geographical location which is far from your routine location i.e. your city when you live and access Gmail daily.
Generally, the servers are not present in the same country or city where we live in and hence when you host your website on such server and try to access Gmail Mailbox from your application you might receive error.
Thus, in order to resolve it, you will need to open browser on the server and login into Gmail. This makes Gmail understand that the server and its IP Address belongs to you and it will allow you to access Gmail Mailbox through your application.