In this Beginners article we will see how simple it is to extract an email addresses from web page.
for demo purpose We will extract all emails from
URL:// http://eggheadcafe.com/aboutus.aspx
Here we will use Email validation regular expression.
You can develop your own regular field validation expressions using Free Expresso tool
Link to download expresso tool for to Learn regualr field expressions in 60min.
http://www.ultrapico.com/Expresso.htm
Here is this line of code
protected void Button1_Click(object sender, EventArgs e)
{
// Create WebRequest
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(http://eggheadcafe.com/aboutus.aspx);
// Initialise the connection
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
// Start receving the Response and store it in to Stream and pass it to Stream reader
StreamReader reader = new StreamReader(response.GetResponseStream());
string responseText = reader.ReadToEnd();
// Here we will apply regualr expression to responseText
//string pattern is Email validation Expressioin
Regex re = new Regex(@"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*");
MatchCollection me = re.Matches(responseText);
String str = string.Empty;
foreach(Match m in me)
{
str += m.Value + " , " ;
}
Response.Write(str);
}
Now, you can use this code to send bulk emails
http://www.revenmerchantservices.com/page/Send-Email.aspx
Satalaj