using openpop.dll to connect to Gmail in C# Service

581 views Asked by At

I am attempting to use the openpop.dll to pull email from gmail account. but I get the following error

Problem logging in using method Auto. Server response was: -ERR [AUTH] Username and password not accepted. Exception thrown: 'OpenPop.Pop3.Exceptions.InvalidLoginException' in OpenPop.dll

I rechecked my User and Password are correct (i can login from the gmail web interface).

In the app.config:

<add key="SmtpHost" value="pop.gmail.com"/>
<add key="SmtpPort" value="995"/>

My code:

client.Connect(Host, Port, true); //UseSSL true or false
LoggerService.Info("Service authentication starts.");
client.Authenticate(Email, Password);

Anyone have a suggestion?

1

There are 1 answers

3
So_oP On

1.Sign into the Gmail account first, and make sure POP is enabled in settings either for ALL MAIL or only for mail that arrives from now on - depending on what you want collected.

2.Google accounts will only allow POP3 access if you have enabled the "less secure apps" feature. This can be done from this link: https://www.google.com/settings/security/lesssecureapps

Let me know if this helpful for you.