【问题标题】:How to download email attachments in c#如何在c#中下载电子邮件附件
【发布时间】:2012-06-13 15:29:23
【问题描述】:

有没有我可以在 c# 中使用的免费库来下载电子邮件附件?是的,这个问题之前已经发布过,但是以前的帖子已经过时了,其中引用的一些项目甚至不再维护。我希望在过去的几年里出现了一些新的东西。

另外,我更喜欢可以与任何东西一起使用的东西,但特定于 Exchange Server 的解决方案也可以。

【问题讨论】:

    标签: c# email attachment download


    【解决方案1】:

    您可以使用EA GetMail Component。这里我给出了一个使用 IMAP potocol 从电子邮件中获取附件的示例

    MailClient oClient = new MailClient("TryIt");
    
    //ServerProtocol.Pop3 to ServerProtocol.Imap4 in MailServer constructor
    
    MailServer oServer  = new MailServer(sServer, 
    sUserName, sPassword, bSSLConnection, 
    ServerAuthType.AuthLogin, ServerProtocol.Imap4);
    
    //by default, the pop3 port is 110, imap4 port is 143, 
    //the pop3 ssl port is 995, imap4 ssl port is 993
    //you can also change the port like this
    //oServer.Port = 110;
    
     oClient.Connect(oServer);
     MailInfo [] infos = oClient.GetMailInfos();
     int count = infos.Length;
     if(count!=0)
     {
       MailInfo info = infos[i];
       Mail oMail = oClient.GetMail(info);
       Attachment [] atts = oMail.Attachments;          
     }
    

    【讨论】:

    • 看起来不错,但是他们的标准许可证限制性太强(即我必须在笔记本电脑或台式机上进行开发...这太愚蠢了)而且他们的专业许可证看起来大约是 60比 Mail.dll 贵 %,它也可以满足我的需要。不过看起来界面不错。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-06
    • 2014-05-25
    • 2021-09-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多