2010-12-16 14 views
4

Ich möchte meinen Gmail-Posteingang mithilfe von Google.GData.Client.dll lesen. Wie erreiche ich das? Ich hätte gerne ein Beispielprogramm.Gmail-Posteingang lesen

+5

google ist dein bester Freund hier einen Blick –

+0

Nehmen: https://developers.google.com/gdata/client-cs Das ist die offizielle Dokumentation. Wenn Sie Ihre Frage in bestimmte Dinge aufteilen könnten, die Sie erreichen möchten, können wir vielleicht mehr helfen. – Brad

Antwort

5

fand ich GMailAtomFeed

// Create the object and get the feed 
    RC.Gmail.GmailAtomFeed gmailFeed = new RC.Gmail.GmailAtomFeed("username", "password"); 
    gmailFeed.GetFeed(); 

    // Access the feeds XmlDocument 
    XmlDocument myXml = gmailFeed.FeedXml 

    // Access the raw feed as a string 
    string feedString = gmailFeed.RawFeed 

    // Access the feed through the object 
    string feedTitle = gmailFeed.Title; 
    string feedTagline = gmailFeed.Message; 
    DateTime feedModified = gmailFeed.Modified; 

    //Get the entries 
    for(int i = 0; i < gmailFeed.FeedEntries.Count; i++) { 
     entryAuthorName = gmailFeed.FeedEntries[i].FromName; 
     entryAuthorEmail = gmailFeed.FeedEntries[i].FromEmail; 
     entryTitle = gmailFeed.FeedEntries[i].Subject; 
     entrySummary = gmailFeed.FeedEntries[i].Summary; 
     entryIssuedDate = gmailFeed.FeedEntries[i].Received; 
     entryId = gmailFeed.FeedEntries[i].Id; 
    } 

auch Sie sollten

http://code.msdn.microsoft.com/CSharpGmail

http://weblogs.asp.net/satalajmore/archive/2007/12/19/asp-net-read-email.aspx

+1

Hinweis: Dieser Feed ist nur für Google Mail-Konten in Google Apps-Domains verfügbar (er sagt nichts über bezahlte und nicht bezahlte aus). https://developers.google.com/google-apps/gmail/gmail_inbox_feed –

+0

Dies funktioniert, aber nur zum Abrufen der E-Mail-Themen und nicht der Körper. Außerdem erhalten Sie nur die besten 20 E-Mails pro Ordner. – ytoledano

0

Verwenden aenetmail des IMAP-Client aussehen: github. Ich denke, es ist eine bessere Alternative als GMailAtomFeed, weil Sie den gesamten Körper der E-Mails abrufen können und es viele viele weitere Optionen hat.

Hier ist ein Beispiel:

using (var ic = new AE.Net.Mail.ImapClient("imap.gmail.com", "email", "pass", AE.Net.Mail.AuthMethods.Login, 993, true)) 
{ 
    ic.SelectMailbox("INBOX"); 
    MailMessage[] mm = ic.GetMessages(0, 10); 
    // at this point you can download the messages 
}