Beispiel #1
0
        private static void GetLogs(IMailgunClient mailgunClient, string domain)
        {
            Action <MailgunEventResponse> print = (response) => {
                foreach (var item in response.Items)
                {
                    Console.WriteLine("Timestamp : {0}; Event : {1}", item.Timestamp.UnixTimeStampToDateTime(), item.Event);
                }
            };

            var events = new MailgunEvents(mailgunClient, domain);

            var eqb = new EventQueryBuilder()
                      .Or(MailgunEvent.Accepted.ToOperand(), MailgunEvent.Delivered.ToOperand(), MailgunEvent.Opened.ToOperand());
            var result = eqb.Build();

            var eventParams = new MailgunEventParams()
            {
                Limit            = 10,
                Pretty           = true,
                FilterFieldType  = result.FilterFieldType,
                FilterFieldValue = result.FilterValue,
            };

            var eventsResponse1 = events.Get(eventParams);
            var i = 1;

            while (eventsResponse1.Items.Count() > 0)
            {
                Console.WriteLine("Printing Page {0}", i++);
                print(eventsResponse1);
                eventsResponse1 = events.Next();
            }
        }
Beispiel #2
0
 public MailgunEvents(IMailgunClient client, string domain)
 {
     fClient   = client;
     fDomain   = domain;
     fPrevious = "";
     fNext     = "";
 }
Beispiel #3
0
 public MailGunEmailNotificationClient(
     IMailgunClient mailGunClient,
     IMailMessageFactory mailMessageFactory)
 {
     _mailGunClient      = mailGunClient;
     _mailMessageFactory = mailMessageFactory;
 }