In this article I will explain how to solve the issue when Gmail server denies POP3 access for the given Username and Password.
 
 
Solutions
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.
Note: You can get information about accessing Gmail Mailbox using POP3 in my article Fetch and read email messages with attachments from GMAIL POP3 mail server in ASP.Net.
 
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.
[SOLVED] Gmail server denied POP3 access for the given Username and Password
 
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.
[SOLVED] Gmail server denied POP3 access for the given Username and Password
 
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.
[SOLVED] Gmail server denied POP3 access for the given Username and Password
 
2. Select Other option in App DropDownList.
[SOLVED] Gmail server denied POP3 access for the given Username and Password
 
3. Give the App, a suitable name and click the Generate Button.
[SOLVED] Gmail server denied POP3 access for the given Username and Password
 
4. Once generated, copy and save the Password (in Yellow Box) somewhere and click Done.
[SOLVED] Gmail server denied POP3 access for the given Username and Password
 
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.
[SOLVED] Gmail server denied POP3 access for the given Username and Password
 
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.