public static void Run()
        {
            using (var context = ApplicationContext.Create(application => application
                                                           .Database(database => database
                                                                     .IntegrationDb(integrationDb => integrationDb
                                                                                    .Disable()))
                                                           .Services(services => services
                                                                     .Advanced(advanced => advanced
                                                                               // We'll override where to read RuntimeSettings from - just for demo purposes
                                                                               // It's recommended to configure these in the app.config instead - which is the default behaviour
                                                                               .Register <IRuntimeSettings>(kernel => new InMemoryRuntimeSettings()
                                                                               // Specify your API key
                                                                                                            .Set("SendGrid.ApiKey", @""))))
                                                           .UseSendGrid(sendGrid => sendGrid
                                                                        .ConfiguredBy(by => by.RuntimeSettings())
                                                                        .ReplaceEmailService()
                                                                        )
                                                           ))
            {
                var email = new TextBasedEmailTemplate("Subject")
                            .WriteLine("Test");

                context.Resolve <IEmailService>().Send(email, "*****@*****.**");
            }
        }
        public static void Run()
        {
            using (var context = ApplicationContext.Create(application => application
                                                           .Database(database => database
                                                                     .IntegrationDb(integrationDb => integrationDb
                                                                                    .Disable()))
                                                           .Services(services => services
                                                                     .Advanced(advanced => advanced
                                                                               // We'll override where to read RuntimeSettings from - just for demo purposes
                                                                               // It's recommended to configure these in the app.config instead - which is the default behaviour
                                                                               .Register <IRuntimeSettings>(kernel => new InMemoryRuntimeSettings()
                                                                               // Specify your API key
                                                                                                            .Set("Mandrill.ApiKey", @"TODO"))))
                                                           .UseMandrill(mandrill => mandrill
                                                                        .WithHttpMessageHandler(kernel => new LoggingHandler(kernel, new HttpClientHandler()))
                                                                        .ConfiguredBy(by => by.RuntimeSettings())
                                                                        .ReplaceEmailService()
                                                                        )
                                                           ))
            {
                var email = new TextBasedEmailTemplate("Subject")
                            .WriteLine("Test");

                context.Resolve <IEmailService>().Send(email, "*****@*****.**");

                //var apiService = context.Resolve<IMandrillApiService>();

                //Reject[] rejects = apiService
                //    .RequestAsync<GetRejects, Reject[]>("rejects/list", new GetRejects())
                //    .Result;

                //context.Resolve<IConsoleWriter>().WriteLine(
                //    string.Join(Environment.NewLine, rejects
                //        .Select(x => $"{x.Email} - {x.reason} - {x.last_event_at}")));

                //Sender[] senders = apiService
                //    .RequestAsync<GetSendersList, Sender[]>("senders/list", new GetSendersList())
                //    .Result;

                //context.Resolve<IConsoleWriter>().WriteLine(
                //    string.Join(Environment.NewLine, senders
                //        .Select(x => $"{x.Address}")));
            }
        }