我正在寻找一个程序,让用户备份gmail(可能通过imap)并将其备份到单个文件或作为pst(我知道pst可能会更难)
谢谢,如果你能提供帮助
解决方法 前段时间我写了一篇关于完全相同主题的博文.有关详情,请参见 HOWTO: Download emails from a GMail account in C#.代码使用我们的Rebex Mail component:
using Rebex.Mail;using Rebex.Net;...// create the POP3 clIEntPop3 clIEnt = new Pop3();try{ // Connect securely using explicit SSL. // Use the third argument to specify additional SSL parameters. Console.Writeline("Connecting to the POP3 server..."); clIEnt.Connect("pop.gmail.com",995,null,Pop3Security.Implicit); // login and password clIEnt.Login(email,password); // get the number of messages Console.Writeline("{0} messages found.",clIEnt.GetMessageCount()); // ----------------- // List messages // ----------------- // List all messages ListPop3MessagesFast(clIEnt); // unique IDs and size only //ListPop3MessagesFullheaders(clIEnt); // full headers}finally{ // leave the server alone clIEnt.disconnect(); }public static voID ListPop3MessagesFast(Pop3 clIEnt){ Console.Writeline("Fetching message List..."); // let's download only what we can get fast Pop3MessageCollection messages = clIEnt.GetMessageList(Pop3ListFIElds.Fast); // display basic info about each message Console.Writeline("UID | Sequence number | Length"); foreach (Pop3MessageInfo messageInfo in messages) { // display header info Console.Writeline ( "{0} | {1} | {2} ",messageInfo.UniqueID,messageInfo.SequenceNumber,messageInfo.Length ); // or download the whole message MailMessage mailMessage = clIEnt.GetMailMessage(messageInfo.SequenceNumber); } }总结
以上是内存溢出为你收集整理的c# – 以编程方式从gmail下载电子邮件(备份)全部内容,希望文章能够帮你解决c# – 以编程方式从gmail下载电子邮件(备份)所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)