How to convert text to rtf to send email?

Since I need to send email by code, I am currently using the outline text, but since Outlook deletes the extra line by default, this wraps my formatting and I don't want that, I tried to put my text in html, but the email is now marked as spam.

My last choice is to move the text to rtf, but now my question is.

What's the easiest way to move text in rtf?

There is no user interface.

The email does not contain complex material, just text and some extra line, which is my current problem with plain text and default setting for Outlook.

And no, I cannot change the default setting for Outlook.

+2


source to share


3 answers


You need to add a reference to System.Windows.Forms and then use the RichTextBox:



string text = "your text here";
string rtfText = string.Empty;
using(RichTextBox rtf = new RichTextBox()) {
    rtf.Text = text;
    rtfText = rtf.Rtf;
}

      

+4


source


If you don't want Outlook to talk to it at all, use the "application / binary" MIME type. You will no longer be able to see the code in the preview area - is this important to you?



+2


source


Really good ur code, for use with VB.net i change some lines:

Dim text As String = dr.Item("Descripcion")
Dim rtfText As String = String.Empty
Dim rtf As New RichTextBox
rtf.Text = Text
rtfText = rtf.Rtf
Me.RichTextBox1.Rtf = rtfText

      

I hope this is helpful

0


source







All Articles