Click here to Skip to main content
16,012,316 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to access gmail inbox into my application by providing the username and password of the account
Posted

You should have tried this[^] and got these and many more:
Offiical GMAIL link for very purpose[^]
Similar discussion 1[^]
Similar diiscussion 2[^]
 
Share this answer
 
using Outlook = Microsoft.Office.Interop.Outlook; //you need to add the Microsoft Office 11.0 Object Library to use this. mine is version 11 you might have an older or later version.

Outlook.Application outlook = new Outlook.ApplicationClass();
Outlook.NameSpace ns = outlook.GetNamespace("Mapi");
object _missing = Type.Missing;
ns.Logon(_missing, _missing, false, true);

Outlook.MAPIFolder inbox = ns.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);

int unread = inbox.UnReadItemCount;
foreach (Outlook.MailItem mail in inbox.Items)
{
string s = mail.Subject;
}
 
Share this answer
 
Comments
Sandeep Mewara 9-Mar-11 0:33am    
Don't confuse OP. You don't need Outlook object for accessing gmail!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900