I have created an email signature using Rich Text Box. I want to sent this to my client through smtp protocol. I know the code to send smtp mail, but how to send this formatted text to the client as mail body?
Thanks in advance.
In order for the body to be formatted like your richtextbox text is formatted, you must write some logic in order to convert the text into html.
when i say logic i mean that you must locate new lines, bold text, text color etc.. inside your richtextbox and convert it to html.
for example lets say that is the text inside your textbox:
Hello
I AM ROBOT
you must write the logic in order to convert it to that string:
<span> Hello <br/> I AM <b>ROBOT</b></span>
after the text is embedded as html
pass it to the .Body
property of MailMessage
class, also .IsBodyHtml
property must be set to TRUE.
here is a a recommended tool for that task: Writing Your Own RTF Converter if you dont want to do it by yourself.