Hi there, my app is work in progress.
a couple of questions for you. I have searched for the solution on the internet, but I find thousands of nonsensical and completely wrong answers.
in message.Body.Content there is the HTML code. How is it possible to save it in a plain text in a VarChar of my table ? I need to convert it, but i can't find a right solution
attacchments file. Which is the best way to save mail attachment ?
TXH for all
Hi Ben Becker,
To save the HTML content in a plain text format into a VARCHAR column in your
database, you'll generally want to convert or strip out the HTML tags to keep
only the text content. There are various ways to do this, depending on the
programming language and libraries you're using.
you could use the HtmlAgilityPack library
using HtmlAgilityPack;
var html = message.Body.Content; var htmlDoc = new HtmlDocument(); htmlDoc.LoadHtml(html);
var plainText = htmlDoc.DocumentNode.InnerText;
// Save `plainText` to your database |
Regards,
Ashok