Torma Kristóf
beab15a7ef
All checks were successful
continuous-integration/drone/push Build is passing
36 lines
1019 B
C#
36 lines
1019 B
C#
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 = 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 }
|
|
);
|
|
}
|
|
}
|
|
}
|