host = "pop.gmail.com"
user = "xxxxx@gmail.com"
password = "xxxx"
port = 995
Pop3Client client = new Pop3Client();
client.connet(host, port, true);
client.Authenticate(user, password, AuthenticationMethod.UsernameAndPassword);
int mailCount = client.GetMessageCount();
在執行authentication時出現exception, InvalidLoginException
解決方法參考 : https://github.com/foens/hpop/issues/39
1-enable the pop at Configurations / Forwarding and POP/IMAP
2- follow this link: https://www.google.com/settings/security/lesssecureapps
and activate for less secure apps. (set [turn on])