Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Sir,

Here am developing one windows application for sending mail with help of google account. I am using richtext box for body part. but i can not send formatted data to mail. only unformatted data is going. So please give me the way to send formatted data to mail.I want to send formatted data directly from richtextbox to mail.


Thank You
Sujith T.P
Posted
Updated 23-Jun-23 7:23am

Hi,
You can send mail in HTML format like this

XML
MailMessage mail = new MailMessage();
mail.To = "me@mycompany.com";
mail.From = "you@yourcompany.com";
mail.Subject = "this is a test email.";
mail.BodyFormat = MailFormat.Html;
mail.Body = "this is my test email body.<br><b>this part is in bold</b>";
SmtpMail.SmtpServer = "localhost";  //your real server goes here
SmtpMail.Send( mail );
 
Share this answer
 
The easiest way to send formatted email is to send it as HTML. There is an extended RichTextBox which accepts and generates HTML here: An extended RichTextBox to save and load "HTML lite" files[^]
 
Share this answer
 
if you have to send formatted mail then use HTML format. it will allow you to format your text like webPage formatting.
mail.BodyFormat = MailFormat.Html
 
Share this answer
 
This solution is for .NET core:
mail.IsBodyHtml = true;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900