0

I have a simple question, but maybe not for a simple answer :

How is it possible with a MailMessage object to send a mail with a body that contains (as string), for exemple, "<b><b></b>" (without any space) ?

In fact, I need to (at the end) open a mail with as body as below :

< b> (without space)

As we can see, we have a three characters '<', 'b', '>' in bold. Indeed, the goal isn't to format an unformatted tag, but just to display a tag unformatted (so not a tag) in a formatted body !

I have as exemple the string <b>This is a tag</b> : <b>, and I simply want to display : "This is a tag : <b>".

I hope that the question is clear :-) Thanks for your knowledge and sharing !

2
  • Do you mean sending HTML as body of your mail? Commented Oct 2, 2017 at 13:41
  • 1
    mail.IsBodyHtml = true; Commented Oct 2, 2017 at 13:45

1 Answer 1

1

Don't use the actual < and > characters, replace them with &lt; and &gt; respectively.

For example the string <b>This is a tag</b> : &lt;b&gt; would be rendered in HTML like this:

This is a tag : <b>

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, this is exactly what I needed :-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.