MailServer oServer = new MailServer("pop.gmail.com", "alpha@convate.com", "Siddhu@1", ServerProtocol.Pop3); MailClient oClient = new MailClient("TryIt"); // Set SSL connection, oServer.SSLConnection = true; // Set 993 IMAP4 port oServer.Port = 995; try { oClient.Connect(oServer); MailInfo[] infos = oClient.GetMailInfos(); MessageBox.Show(infos.Length.ToString()); for (int i = 0; i < infos.Length; i++) { MailInfo info = infos[i]; Console.WriteLine("Index: {0}; Size: {1}; UIDL: {2}", info.Index, info.Size, info.UIDL); // Download email from GMail IMAP4 server Mail oMail = oClient.GetMail(info); MessageBox.Show("From" + oMail.From.ToString()); MessageBox.Show("Subject" + oMail.Subject); MessageBox.Show("body" + oMail.TextBody); oClient.Delete(info); } // Quit and pure emails marked as deleted from Gmail IMAP4 server. oClient.Quit(); } catch (Exception ep) { MessageBox.Show(ep.Message); }
Quote:Because Gmail POP3 server doesn't work like normal POP3 server, it hides old emails automatically even the email was not deleted, so we suggest that you use IMAP4 protocol.
IMAP4
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)