コード例 #1
0
        public async Task SendLicenseChangedAsync(DateTime createdAt, LicenseOrderStatus status, IList <ApplicationUser> administrators)
        {
            EmailSettings emailSettings = await GetEmailSettingsAsync();

            ServerSettings serverSettings = await GetServerSettingsAsync();

            var htmlMessage = GetTemplate("mail-license-order-status");

            htmlMessage = htmlMessage.Replace("{{createdAt}}", createdAt.ToString()).Replace("{{status}}", status.ToString());

            foreach (var admin in administrators)
            {
                MailMessage   mailMessage = new MailMessage(emailSettings.UserName, admin.Email);
                AlternateView htmlView    = AlternateView.CreateAlternateViewFromString(htmlMessage, Encoding.UTF8, MediaTypeNames.Text.Html);
                htmlView.LinkedResources.Add(CreateImageResource("img_hideez_logo"));
                mailMessage.AlternateViews.Add(htmlView);
                mailMessage.IsBodyHtml = true;
                mailMessage.Subject    = $"Hideez License Order Status Update - {serverSettings.Name}";

                await SendAsync(mailMessage, emailSettings);
            }
        }
コード例 #2
0
        public async Task SendLicenseChangedAsync(DateTime createdAt, LicenseOrderStatus status)
        {
            var administrators = await GetAllAdministratorsAsync();

            await _emailSenderService.SendLicenseChangedAsync(createdAt, status, administrators);
        }