0 votes

When i use standard System.Net.Mail.MailMessage my text automatic converts to html. If i have url - its convert it to clickable url. If i have line breaks - its add it to message.

How convert plain text to html with your lib?

by (930 points)

1 Answer

0 votes

I'm not sure what you mean. I don't think System.Net.Mail.MailMessage converts plain text to HTML content - never heard of such feature.

When you create an email you can create plain text email, HTML email, or include both formats for recipients to choose from.

You use MailBuilder class to create new email message. Use its Html property to set HTML data. Mail.dll automatically extracts plain text data from HTML content when Html property is set, so following code results with email that has both text.plain and text/html parts:

MailBuilder builder = new MailBuilder();
builder.Html = "This is <strong>HTML</strong> message";
IMail email = builder.Create();

You can find more details here:
https://www.limilabs.com/blog/send-html-email

by (276k points)
...