First of all, you are using
IdentityMessage
, instead of a
MailMessage
.
IdentityMessage Class (Microsoft.AspNet.Identity) | Microsoft Docs[
^]
MailMessage Class (System.Net.Mail) | Microsoft Docs[
^]
There was option with
MailMessage
to send HTML content, and have it processed and delivered with special MIME. If you want to send the email with HTML content in it, you need to set the
IsBodyHtml
flag to be true, so anywhere before
SendMailAsync()
, do this,
client.IsBodyHtml = true;
Then send the email, and this time it will be parsed as HTML document and rendered properly. Also one thing that you can always send a link to your web page so your viewers can link on the click to preview it as an HTML document if their mail software is broken or older.
See here,
MailMessage.IsBodyHtml Property (System.Net.Mail) | Microsoft Docs[
^]
One more thing, .NET Core recommends to use MailKit for emails in .NET Core,
GitHub - jstedfast/MailKit: A cross-platform .NET library for IMAP, POP3, and SMTP.[
^]. You can check out how that SDK enables you to send HTML bodied documents.