在 Win Forms 中处理 Gmail (Send/Receive)

Handle Gmail (Send/Receive) in Win Forms

出于某些原因,我想为自己开发 Gmail 桌面应用程序 在 C# 中。这样我就可以检索电子邮件(包括附件) (我不想使用 outlook/thunderbird 等桌面客户端)

所以请建议什么是更好的选择,到目前为止我有以下两个 我可以从哪里开始:

https://developers.google.com/gmail/api/quickstart/dotnet#step_1_turn_on_the_api_name

https://gmailerxp.codeplex.com/

Install-Package OpenPop.NET

看看OpenPop.NET:https://github.com/foens/hpop

using (var client = new Pop3Client())
{
    client.Connect("pop.gmail.com", 995, useSsl: true,
        receiveTimeout: 30 * 1000, sendTimeout: 60 * 1000,
        certificateValidator: null);

    client.Authenticate("username", "password");

    var messageUids = client.GetMessageUids();
    foreach (var messageUid : messageUids)
    {
        Console.WriteLine("Received email: " + messageUid);
    }
}

如果使用定制程序,您必须降低帐户安全性。 https://support.google.com/accounts/answer/6010255?hl=en

试试DevMvcComponent 3.0

Install-Package DevMVCComponent

https://github.com/aukgit/DevMvcComponent 使用此自述文件。

var gmailServer = new GmailServer("you@gmail.com", "password");
gmailer.QuickSend("sendingto@gmail.com", "Subject", "HTML body");

那你可以走了。