Tuesday, October 21, 2008

Contact Us Form

Creating Contact Us Form easily using ASP.NET and SMTP
This article explain how to create a simple contact us form by using ASP.NET and System.Net.Mail to send email to the website owner

Introduction

A lot of times, we as a web master want to include a contact us form in our web site to gather sales questions from our site visitors. I can see that most of the people actually just include an email like sales@domainname in their Contact Us Page. I know that one works well if you just starting your site. However as your site is getting popular, you will notice that lots of spam email comes to your inbox and you probably has to spend hours and hours just to delete each of the spam email and also you might accidentally delete one of the legitimate email and thus you will lose your website sales.

So the workaround is to create a simple Contact Us Form with Captcha Image to prevent robot from sending spam to you and the result of the Contact Us Form will be sending email to you as a website owner, or you can save into database if you like to. I will show you code sample on sending email from your contact us form. For saving into database, you might need to check my other article on Basic ADO.NET.

Contact Us Form in ASP.NET 2 with Captcha


First, open Visual Studio 2005 and Add New Page called ContactUs.aspx
In the ASPX Page, please copy and paste the code below.

 <FORM ID="form1" RUNAT="server">

<H2>Contact Us Form
podcast directory
Bloglisting.net - The internets fastest growing blog directory

RSS Feed

Blog Directory & Search engine

Followers

About Me