Created
May 27, 2013 17:42
-
-
Save nootanghimire/5658255 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using Limilabs.Mail; | |
using Limilabs.Client.IMAP; | |
namespace ConsoleApplication1 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
using (Imap imap = new Imap()) | |
{ | |
imap.ConnectSSL("imap.gmail.com", 993); // or ConnectSSL for SSL | |
//See Port and Host Details: https://support.google.com/mail/answer/78799?hl=en | |
imap.Login("email@gmail.com", "paswordhere"); | |
imap.SelectInbox(); | |
List<long> uids = imap.Search(Flag.All); | |
//There are lots of possible flags. Use intelliSense of VS to get the list | |
//i.e, type Flag. <and a list pops> | |
foreach (long uid in uids) | |
{ | |
string eml = imap.GetMessageByUID(uid); | |
IMail email = new MailBuilder() | |
.CreateFromEml(eml); | |
Console.WriteLine(email.Subject); | |
Console.WriteLine(email.Text); | |
} | |
Console.ReadLine(); | |
imap.Close(); | |
} | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment