2009-05-29 11 views
6

Herkes bir gmail hesabının her bir e-postasının toplu dökümü yapmak ve e-postaları bir dosyaya yazmak için bir yol biliyor mu? Ben (muhtemelen IMAP üzerinden) oraya geri kullanıcıların gmail izin verecek bir program yazmak ve dosyaları tek tek ya veya bir pst olarak yedeklemek için arıyorumgmail programından indirilen e-postaları (yedekleme)

(i pst muhtemelen çok daha zor olacak biliyorum)

Yardım edebilirsiniz:

cevap

5

bir süre önce tam olarak aynı konu hakkında bir blog yazısı yazdım. Detaylar için bakınız HOWTO: Download emails from a GMail account in C#.

Kod kullanır bizim Rebex Mail component: Windows (kullanarak py2exe'yi) için derlenmiş bir açık kaynak Python programı de yoktur

using Rebex.Mail; 
using Rebex.Net; 
... 
// create the POP3 client 
Pop3 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); 
    } 
} 
4

Gmail POPaccess sağlar. Yani sadece POP kullanarak iletişim kurmanıza izin veren herhangi bir library kullanın ve altınsınız.

Düzeltme: IMAP'den bahsettiğinizi fark ettim; Toplu dökümler için POP kullanmanız önerilir. IMAP yapmak istediğiniz şey için çok konuşkan.

IMAP kullanmanız gerekiyorsa, işte size a library.

0

https://github.com/jay0lee/got-your-back/wiki

Ama Mac kullanıcıları hangi ı sığınak (derlemek gerekir Tamamen bir py2exe hatası nedeniyle çözüldü.

Her iki durumda da, programı otomatik olarak bir programda yürütmenin bir yoluna ihtiyacınız vardır.