0

Possible Duplicate:
Read Gmail Inbox

I need to make an application in C# Visual Studio that I can read the latest email of a Gmail account. I just need to get in 3 textbox: From, Subject and the bodymessage.

But I only need to get the information of the latest received email. Please guys, I really need your help.

Thanks a lot :)

Community
  • 1
  • 1
NathanWay
  • 139
  • 1
  • 8

1 Answers1

2

Try reading about POP3, IMAP protocol Here is the visual studio example and once you can read the email you can check the server based on mail date and select the latest one

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

Here is the code:

  // 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; 
   }
Jeremy Thompson
  • 61,933
  • 36
  • 195
  • 321
sumeet kumar
  • 2,628
  • 1
  • 16
  • 24
  • Usually [so] answers contain some code... I dont see why you didn't put this as a comment? – Jeremy Thompson Feb 05 '13 at 00:55
  • Next time will follow that sorry for violation...as this question requires a generic implementation so shared the link which contains the code..!! sorry about that – sumeet kumar Feb 05 '13 at 00:57
  • 1
    +1 No worries at all. It's customary in [so] (and Superuser) answers to include a summary of the contents of a link or the highlights that specifically answer the question. The goal of SE sites is to become a resource of knowledge, of answers, for years to come. With a link-only answer, the op must dig through another resource to locate an answer he/she might not be sure about. Most importantly, if your link were to ever break, your answer is useless for anyone who visits this page in the future. I made an edit to your answer to add more details. Good luck! – Jeremy Thompson Feb 05 '13 at 01:00