3

I want to read my Gmail Inbox by using Google.GData.Client.dll. How do I accomplish this? I would like a sample program.

SwDevMan81
  • 48,814
  • 22
  • 151
  • 184
anbuselvan
  • 1,201
  • 4
  • 16
  • 21
  • Take a look here: https://developers.google.com/gdata/client-cs That is the official documentation. If you could break down your question into specific things you would like to accomplish, we may be able to help more. – Brad Dec 16 '10 at 14:49

2 Answers2

5

I found 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; 
   }

also you should look

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

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

Soner Gönül
  • 97,193
  • 102
  • 206
  • 364
  • 1
    Note: This feed is only available for Gmail accounts on Google Apps domains (It doesnt seem to say anything about paid vs. unpaid). https://developers.google.com/google-apps/gmail/gmail_inbox_feed – Simon_Weaver Dec 01 '12 at 06:48
  • This works, but only for retrieving the email subjects and not the bodies. Also, you only get the top 20 emails per folder. – ytoledano Mar 30 '14 at 21:10
0

Use aenetmail's IMAP client: github. I think it's a better alternative than GMailAtomFeed because you can retrieve the entire body of the emails and it has many many more options.

Here's an example:

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
}
ytoledano
  • 3,003
  • 2
  • 24
  • 39