Placing the code in ~ / Content / Templates / and loading the content using the web client worked best for me.
var welcomeMailTemplatePath = "yourPath";
var webClient = new WebClient();
string html = webClient.DownloadString(WelcomeMailTemplatePath);
This way you do not need to deal with controllers / views and can directly capture the contents of a template file.
source
share