Exemple #1
0
        public static void Main(string[] args)
        {
            // use thunderbird
            var api = new GmailApi();

            api.GetEmails();
        }
Exemple #2
0
        public static void PrintEmails(object sender, ElapsedEventArgs e)
        {
            IEmailApi api = new GmailApi();

            var filterConfigFile = new IgnoreFiltersConfigFile();

            filterConfigFile.Clear();
            filterConfigFile.Append(new Filter(FilterOption.AllFolders));
            //filterConfigFile.Append(new List<Filter>()
            //{
            //    new Filter(FilterOption.AllFolders),
            //    new Filter(FilterOption.Read)
            //});

            var filters = filterConfigFile.GetFilters();
            var query   = new GmailQuery(filters);
            var emails  = api.GetEmails(query);

            emails.ForEach(email =>
                           Console.WriteLine($"Email ID: {email.Id} Time received: {email.TimeReceived}. " +
                                             $"Subject: {email.Subject} Time: {email.TimeReceived}"));

            Console.WriteLine("-----------------------");
        }