dblwizard
dblwizard

Reputation: 627

Invalid Char in body when using ExchangeServices.SendEmail

I have some code that sends emails when there is an error. One of the things it includes is the "Stack Trace". Well sometimes that Stack Trace ends up with some "special characters" or escape sequences that get converted to special characters, it looks something like this:

at CrystalDecisions.CrystalReports.Engine.FormatEngine.W(Stream q, String r)

You can see the special characters at the end, "(Stream q, String r)." In this example its acutally a 0x08. I have another example where its 0x03 and 0x1a. This causes and "Invalid Char" exception. I'm wondering if there is a way to scan/replace any/all "invalid chars" before sending the message? I dont' want to have to "know" all the possible invalid chars. The call being made is:

ExchangeServices.SendEmail(creds, fromEmailAddr, toEmailAddr, subject, body)

I have verified that its in the StackTrace output in visual studio. Its not caused by converting the string in my code.

dbl

Upvotes: 0

Views: 92

Answers (0)

Related Questions