Пример #1
0
        public async Task <IActionResult> RequestAccess(string currentEmailAddress)
        {
            var emailString =
                $"{User.FullName()} - {User.IdirUserName()} - {currentEmailAddress} - Has requested access to Sheriff Scheduling on {DateTime.Now}.";

            var requestAccessEmailAddress = Configuration.GetNonEmptyValue("RequestAccessEmailAddress");

            await ChesEmailService.SendEmail(emailString,
                                             "Access Request", requestAccessEmailAddress);

            return(NoContent());
        }
Пример #2
0
        public async Task SendTestEmail()
        {
            var env = new EnvironmentBuilder(null, null, null);

            var options =
                EnvironmentBuilder.CreateIOptionSnapshotMock(env.Configuration.GetSection(ChesEmailOptions.Position)
                                                             .Get <ChesEmailOptions>());

            var httpClientFactory = new Mock <IHttpClientFactory>();

            httpClientFactory.Setup(_ => _.CreateClient(It.IsAny <string>())).Returns(new HttpClient());

            var chesService = new ChesEmailService(options, httpClientFactory.Object, env.LogFactory.CreateLogger <ChesEmailService>());

            await chesService.SendEmail("Hello", "Test",
                                        env.Configuration.GetNonEmptyValue("TestEmailAddress"));
        }