I have a small application written in c# as a console app that I want to use to send an email. I was planning on storing the email inside an xml file along with other inform
Use a CDATA section, that will contain your email HTML code :
<?xml version="1.0"?>
<myDocument>
<email>
<![CDATA[
<html>
<head><title>My title</title></head>
<body><p>Hello world</p></body>
</html>
]]>
</email>
</myDocument>
You can use CDATA section in your XML - here you can read about it.
You could store the HTML as CDATA within the XML.
But looking at what you are trying to do, you may wish instead look at the System.Web.UI.WebControls.MailDefinition class, as it already contains a reasonable way of using mail templates.
The msdn documentation gears towards it being used in WinForms apps, but you can simply use a ListDictionary to fill the replacements.
Here is a simplistic example, to give an idea of how MailDefinition can be used, I won't go into to much detail, as it's a little outside of the scope of the original question.
protected MailMessage GetNewUserMailMessage(string email, string username, string password, string loginUrl)
{
MailDefinition mailDefinition = new MailDefinition();
mailDefinition.BodyFileName = "~/mailtemplates/newuser.txt";
ListDictionary replacements = new ListDictionary();
replacements.Add("<%username%>", username);
replacements.Add("<%password%>", password);
replacements.Add("<%loginUrl%>", loginUrl);
return mailDefinition.CreateMailMessage(email, replacements, this);
}
The easiest way would be to store the HTML content in a CDATA section:
<mail>
<subject>Test</subject>
<body>
<![CDATA[
<html>
...
</html>
]]>
</body>
</mail>