ArgumentNullException: Value cannot be null. (Parameter 'host')
I keep getting this error no matter what I do outside of trying to log in it'll give me invalid login attempts and it tells me some usernames are already taken when I try to re-register a user but when I register the user initially it'll give me the null exception.
public async Task SendEmailAsync(string emailTo, string subject, string htmlMessage)
{
var email = new MimeMessage();
email.Sender = MailboxAddress.Parse(_mailSettings.Mail);
email.To.Add(MailboxAddress.Parse(emailTo));
email.Subject = subject;
var builder = new BodyBuilder()
{
HtmlBody = htmlMessage
};
email.Body = builder.ToMessageBody();
using var smtp = new SmtpClient();
smtp.Connect(_mailSettings.Host, _mailSettings.Port, SecureSocketOptions.StartTls);
smtp.Authenticate(_mailSettings.Mail, _mailSettings.Password);
await smtp.SendAsync(email);
smtp.Disconnect(true);
}