HI ,

I want to import emails from my Gmail account to my application, can anybody please help me out with code , links or procedure for to implement this .

Thanks in Advance
:) :) :) :)

Thanks a lotssss for your help.
actully i am looking for code for to get email i.e the message body .

I'm not exactly sure what do you mean by "open my gmail inbox in c#". If it means "find list of messages in the inbox, download them and read them" you have several options.

The easiest one is using one of protocols designed for reading email such as POP3 and IMAP. Both are supported by Gmail. Before using them make sure that they are enabled: Go to gmail, click "Settings", click "Forwarding and POP/IMAP" and check the form.

The .NET Framework does not have a built-in support for POP3 or IMAP. You have to find a third party component. The Gmail requires an encrypted communication channel, which means that you need a component which supports POP3/SSL or IMAP/SSL. There are at least three free POP3 libraries at codeproject.com but I'm not sure whether they support POP3/SSL.

using Rebex.Mail;
using Rebex.Net;
// -----------------
// create the POP3 client
// -----------------
Pop3 client = new Pop3();
   // -----------------
   // connect and login
   // -----------------
   // 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
   Pop3MessageCollection messages = 

   // display basic info about each message
   Console.WriteLine("UID | Sequence number | Length");
   foreach (Pop3MessageInfo message in messages)
         "{0} | {1} | {2} ",
   // leave the server alone

You may download the component at rebex.net.

This article has been dead for over six months. Start a new discussion instead.