hello
into my project development i put send email in case of system exception with putin the message in bold so i have slect the propriety isbodyhtml as true but when the error message contains ui element the selector value is not appearing in the email screenshot below
any idea how can i put the selector with bold text in the email?
thanks
postwick
(Paul Ostwick)
June 2, 2021, 7:37pm
2
That’s because the <
character that’s part of the selector makes Outlook think it’s HTML code.
Put it inside <pre>
and </pre>
tags, in other words…
"<pre>" + exception.Message + "</pre>"
2 Likes
postwick
(Paul Ostwick)
June 2, 2021, 7:51pm
3
Please mark my reply as the solution if it solves your issue.
i put as you said but its not working…
postwick
(Paul Ostwick)
June 2, 2021, 7:53pm
5
Try this instead…
system.web.HttpUtility.HtmlEncode(exception.Message)
ppr
(Peter Preuss)
June 2, 2021, 7:54pm
6
Can you check
"<b>" + exception.Message + "</b>"
or
"<strong>" + exception.Message + "</strong>"
postwick
(Paul Ostwick)
June 2, 2021, 8:18pm
9
What is the result of
system.web.HttpUtility.HtmlEncode(exception.Message)
You can’t just say “it’s not working” - give us details. Error message? Text shows up but wrong? Text doesn’t show up?
(You can view the email source to see that the selector is there)
One simple way of dealing with it is just to replace the < and >
with [ and]
Replace(Replace(exception.Message,“<”,“[”),“>”,“]”)
1 Like
ppr
(Peter Preuss)
June 2, 2021, 8:21pm
10
então seria:
"campo <b>Estimated resolution</b> e campos <b>Quantidade de...</b>"
was flagged as solution, so we do have second source
rchabbeh:
its not working…
with a detail description on what is not working / the result we could better help
isHtml is activated we do assume
Also combined with Pauls input to encode entities it should work.
so test bold
test encoding entities
test combined
rchabbeh
(rahma)
June 2, 2021, 8:40pm
11
this way is working its clear that the problem is in the caracters < and >
i try to find a way to keep them as text
postwick
(Paul Ostwick)
June 2, 2021, 9:38pm
12
Yes, as I already explained < and >
are characters that are used in HTML code. So Outlook thinks the selector is HTML code, and tries to parse it.
That’s why you need to use…
system.web.HttpUtility.HtmlEncode(exception.Message)
This will convert the < and >
to < and >
so that Outlook will display it instead of trying to use it as HTML.
rchabbeh
(rahma)
June 3, 2021, 7:52am
13
i have put the function as you mentioned but I got this error.
postwick
(Paul Ostwick)
June 3, 2021, 12:29pm
14
What dependencies do you have in your project?