Did OpenPOP.net with GMail attachments break recently?

若如初见. 提交于 2020-01-06 06:36:24

问题


I could swear this code was working few days ago. I'm using the SSL binaries from http://trixy.justinkbeck.com/2009/07/c-pop3-library-with-ssl-for-gmail.html

        POPClient client = new POPClient("pop.gmail.com", 995, "user@gmail.com", "qwerty", AuthenticationMethod.USERPASS, true);

        int unread = client.GetMessageCount();

        for (int i = 0; i < unread; i++)
        {
            Message m = client.GetMessage(i + 1, true);

            Console.WriteLine(m.Subject);

            if (m.HasAttachment)
            {
                Attachment a = m.GetAttachment(1);

                // Problem! HasAttachment flag is set, but there's no attachments in the collection!

                m.SaveAttachment(a, a.ContentFileName);
            }
        }
        client.QUIT();

But today, I can read the mail ok but the attachments are empty. I'm thinking the China fiasco caused them to change something. Ideas?


回答1:


OpenPop.Net now has SSL support directly in itself. It also had a lot of other upgrades. You should consider moving to the new version.




回答2:


Message m = client.GetMessage(i + 1, true);

got only the headers, and by changing it to

Message m = client.GetMessage(i + 1, false);

it works again.



来源:https://stackoverflow.com/questions/2098658/did-openpop-net-with-gmail-attachments-break-recently

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!