In .Net Core, we can send HTML email using
bodyBuilder.HtmlBody = @"<div> anything </div>"
It's there a way to load the <div>
content from external .html file, something like
bodyBuilder.HtmlBody = (load msg.html)
In .Net Core, we can send HTML email using
bodyBuilder.HtmlBody = @"<div> anything </div>"
It's there a way to load the <div>
content from external .html file, something like
bodyBuilder.HtmlBody = (load msg.html)
Just read the contents of the file like it is a regular text file. The simplest way to do that by calling File.ReadAllText method:
string htmlFilePath = "msg.html";
bodyBuilder.HtmlBody = File.ReadAllText(htmlFilePath);
Don't forget about namespace:
using System.IO;
I believe the required NuGet package is System.IO.