Click here to Skip to main content
12,632,234 members (29,592 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# C#4.0
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 23-Jan-13 23:13pm
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

You can use ADO.Net code get the data from database. Take a look at classes and methods under SqlClient namespace.
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Try it

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


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

  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.161208.2 | Last Updated 24 Jan 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100