using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.IO; using System.Net.NetworkInformation; using System.Net.Security; using System.Net.Sockets; using Limilabs.Client.IMAP; using Limilabs.Client.POP3; using Limilabs.Client.SMTP; using Limilabs.Mail; using Limilabs.Mail.MIME; using Limilabs.Mail.Fluent; using Limilabs.Mail.Headers; public partial class reademail : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { using (Imap imap = new Imap()) { imap.ConnectSSL("imap.gmail.com", 993); imap.UseBestLogin("imran.sargodha@gmail.com", "I0483721904"); imap.SelectInbox(); // get all email uids List uids = imap.Search(Flag.Forwarded); foreach (var uid in uids) { var eml = imap.GetMessageByUID(uid); IMail email = new MailBuilder().CreateFromEml(eml); Response.Write(email.Subject); Response.Write("
"); Response.Write(email.Text); Response.Write("
"); Response.Write("
"); Response.Write("
"); } } } protected void Button1_Click(object sender, EventArgs e) { } }