public async Task SendEmailAsync(string body) { await _smtpService.SendEmailAsync( _configuration.DefaultToAddress, _configuration.DefaultFromAddress, _configuration.DefaultSubject, body, _configuration.DefaultCCAddresses, _configuration.DefaultIsBodyHtml, _configuration.Username, _configuration.Password, _configuration.Timeout); }
private async Task SendEmailAsync( string to, string subject, string resourceUrl, Dictionary <string, string> dictionary ) { var stream = File.OpenRead(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, resourceUrl)); using var reader = new StreamReader(stream); var body = reader.ReadToEnd(); foreach (var item in dictionary) { subject = subject.Replace($"{{{item.Key}}}", item.Value); body = body.Replace($"{{{item.Key}}}", item.Value); } await _smtpService.SendEmailAsync(to, subject, body); }
public async Task SendEmail([FromBody] Email email) { await _smtpService.SendEmailAsync(email); }