So I have a method that is setup to send email notifications to the user that is submitting the form as well as management for approval. Previously the logic was sending the entire form as the body of the email, which is fine if they complete the entire
form and all the line items, IF they submit the form and only complete 2 lines of details, the email is sent but the body contains a lot of empty lines from the form which just doesn't look good to the end user.
So we are trying to send ONLY the data that is completed to clean up the email a bit and look better.
Here is 2 attempts we have and are trying, but one of the errors we get is the subject of this post and can be seen below.
private void MailNotification(int typeid, string requestor = null)
{
StringBuilder sb = new StringBuilder();
StringWriter sw = new StringWriter(sb);
HtmlTextWriter hw = new HtmlTextWriter(sw);
...
Go to the complete details ...