示例#1
0
        public async Task <bool> SendTemplateMailAsync <T>(string templateName, T model) where T : EmailModel
        {
            try
            {
                var body = await _renderer.RenderAsync($"Emails/{templateName}", model);

                return(await SendMailAsync(model.Name, model.Email, model.Subject, body));
            }
            catch (Exception ex)
            {
                _logger.LogError($"Failed while rendering or sending template email: {ex}");
                return(false);
            }
        }
示例#2
0
        public async Task SendTemplateMailAsync <T>(string templateName, T model) where T : EmailModel
        {
            var body = await _renderer.RenderAsync($"Emails/{templateName}", model);

            await SendMailAsync(model.Name, model.Email, model.Subject, body);
        }