using Microsoft.AspNetCore.Identity.UI.Services; using Microsoft.Extensions.Options; using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Mail; using System.Threading.Tasks; namespace HanyadikHetVan.Infrastructure { public class EmailSender : IEmailSender { private readonly EmailSenderConfig _emailsenderconfig; public EmailSender(IOptions emailsenderconfig) { _emailsenderconfig = emailsenderconfig.Value; } public Task SendEmailAsync(string email, string subject, string htmlMessage) { var client = new SmtpClient(_emailsenderconfig.Host, _emailsenderconfig.Port) { UseDefaultCredentials = false, EnableSsl = false }; return client.SendMailAsync( new MailMessage(_emailsenderconfig.UserName, email, subject, htmlMessage) { IsBodyHtml = true } ); } } }