The code in my AdminController.cs
await UserManager.SendEmailAsync(
user.Id, "Confirm your account",
"Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>"
);
Does not appear to attempt to send an email.
IdentityConfig.cs
public Task SendAsync(IdentityMessage message)
{
// Plug in your email service here to send an email.
SmtpClient client = new SmtpClient();
client.UseDefaultCredentials = true;
MailMessage mail = new MailMessage("noreply@website.com", message.Destination);
mail.Subject = message.Subject;
mail.Body = message.Body;
mail.IsBodyHtml = true;
return client.SendMailAsync(mail);
}
I use the following code elsewhere in my application which does work.
IdentityMessage emailMessage = new IdentityMessage
{
Destination = recipient.Email,
Subject = "You have a new message - " + message.Subject,
Body = "<p>Message from: " + recipient.UserName + "</p>" + message.Body
};
EmailService emailService = new EmailService();
emailService.SendAsync(emailMessage);
I have seen a few similar questions but as far as I can see, my setup should be working.
Any advice much appreciated.
Thanks!