You could do something like this.
//set string builder to create html for email. This will be
//set to a string variable in your ssis package
System.Text.StringBuilder objMsg = new System.Text.StringBuilder();
objMsg.Append("<html><head><style type='text/css'>table td {border: solid 1px black; padding-left: 10px; padding-right: 10px;}</style></head><body><div style='font-family: tahoma, geneva, verdana; font-size: 10pt;'>");
objMsg.Append("<p>The following table contains files that do not match the required format.</p>");
objMsg.Append("</div></body>");
string[] files = Directory.GetFiles("directory");
foreach (string file in files)
{
// if extension is invalid then append table for html email payload
if (Path.GetExtension(file).ToLower() == ".txt" || Path.GetExtension(file).ToLower() == ".csv")
{
objMsg.Append("<p style='margin-left: 30px;'>Details:</p><table style='margin-left: 30px; font-family: monospace; font-size: 9pt; text-align: right; width: 5in;'><tr style='background-color: silver; color: white; font-weight: bold;'><td style='width: 100%'>File Name</td></tr>");
objMsg.Append("<tr>");
objMsg.Append("<td>" + Path.GetFileName(file) + "</td>");
objMsg.Append("</tr>");
File.Move(file, "errordirectory" + Path.GetFileName(file));
}
}
Dts.Variables["your user variable here"].value = objMsg.ToString();
My apologies for the rough formatting I was trying to do this quickly while at work.
What this will do is loop thru the file in your source directory and add an entry to a string builder object that will ultimately build a table in html with a leading message that reads "The following table contains files that do not match the required format."
Within the If statement it will also move the files identified to a new directory.
once you have run this step then you can assign the string variable you added the html to as the body of your email step.