I want to create a template with XML or HTML with placeholders for exception reporting variables to be swapped in at runtime when an exception occurs. I like what I've got so far with the template, and behavior, but it's all hard coded at the moment, so bad.
Here's a sample of the code I have...
'Styling (Outlook does not follow CSS standards >:-( )
body = "<html><head>" & _
"<style type=""text/css"">" & _
" * {font:12px Arial, Helvetica, sans-serif;}" & _
" table {border-collapse:collapse;}" & _
" table.grid td {padding:0 7px;border:solid #ccc 1px;}" & _
" .bold {font-weight:bold;padding-right:12px;}" & _
"</style></head><body>"
'Partial template
body &= "<table><tr><td class=""bold"">Error:</td><td>" & ex.Message & "</td></tr>" & _
"<tr><td class=""bold"">Exception:</td><td>" & ex.GetType().FullName & "</td></tr>" & _
"<tr><td class=""bold"">Source:</td><td>" & ex.Source & "</td></tr>" & _
"<tr><td class=""bold"">Request Url:</td><td>" & Request.Url.ToString & "</td></tr></table><br />"
Notice the ex.Message
variable, etc. I want to move all the HTML code into a separate file (XML or HTML, depending on what is recommended, XML I imagine?) along with placeholders for each of the error variables. Then load the template, substitute in the variables and send the email on the fly. What is the best practice for doing this?
Also, please don't try to fix my CSS, that's not what this question is about. Outlook doesn't follow standards (go figure), and this is how I had to do it.
Thanks. ;)