C# Use Pop3Client to read gmail

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])

上一篇:BZOJ4049 [Cerc2014] Mountainous landscape


下一篇:Hibernate知识点总结