I have searched for days trying to figure out how to use my C# Windows Form App to send html formatted email from a user inputted textbox to some email addresses. I have only found how to use ASP.net to do this, but i am not using ASP.net. Just need to get the email to be formatted with html and have parts of it be substituted with other info from the app. Here is something I found that should work, but I am guessing only works with ASP.net:
private string PopulateBody(string userName, string title, string url, string description)
{
string body = string.Empty;
using (StreamReader reader = new StreamReader(Server.MapPath("~/EmailTemplate.htm")))
{
body = reader.ReadToEnd();
}
body = body.Replace("{UserName}", userName);
body = body.Replace("{Title}", title);
body = body.Replace("{Url}", url);
body = body.Replace("{Description}", description);
return body;
}
StreamReader reader = new StreamReader(Server.MapPath("~/EmailTemplate.htm"))
part says that "Server" cannot be used.
Is there a different way to have a html template be read and have items replaced in it then sent to an email address? Any help is appreciated!!