Click here to Skip to main content
15,886,724 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I want to store and retrive email body, email contains tables, url links.

i am storing email body as string in sql table text column.

how to retrive email with all tables, links,urls.

thanks..
Posted

You can use ADO.Net code get the data from database. Take a look at classes and methods under SqlClient namespace.
 
Share this answer
 
Try it

C#
// USE THIS LIBRARY [DOWNLOAD FROM INTERNET]
using HtmlAgilityPack;


C#
string sReturn = string.Empty;

HtmlDocument htmldoc = new HtmlDocument();
htmldoc.LoadHtml(HtmlString);

// TO GET URL OF ALL LINKS IN HTML PAGE
IEnumerable<HtmlNode> hn = htmldoc.DocumentNode.Descendants();
foreach (HtmlNode nd in hn)
{

	if (nd.Name.ToLower() == "a")
        {
        	sReturn += nd.Attributes["href"].Value + @"\r\n";
	}
}

// NOW USE "sReturn" Variable


// TO GET VALUE OF ALL INPUT FIELDS
IEnumerable<HtmlNode> hn = htmldoc.DocumentNode.Descendants();
foreach (HtmlNode nd in hn)
{

	if (nd.Name.ToLower() == "input")
        {
        	sReturn += nd.Attributes["value"].Value + @"\r\n";
	}
}

// NOW USE "sReturn" Variable
 
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