How Do I: Create a “Contact Us” Page?

Build a web page to collect information from the user with the Wizard control, validate that information, and use the System.Net.Mail classes to send a confirmation email message.

Duration: 13 minutes, 59 seconds

Date: 24 January 2006

Watch the video   |   Download the video   |   Get VB code  or  C# code

Video downloads: WMV | Zune | iPod | PSP | MPEG-4 | 3GP

Audio downloads: AAC | WMA | MPEG-4 | MPEG-3 | MPEG-2

Comments : 11

Leave a Comment

huuson : On April 14, 2008 2:01 PM said:

In this video, i see you can send email in localhost.

private void SendMail(string from, string body)

   {

       string mailServerName = "SMTP.MyDomain.com";

       MailMessage message = new MailMessage(from, "scott@vertigosoftware.com", "feedback", body);

       SmtpClient mailClient = new SmtpClient();

       mailClient.Host = mailServerName;

       mailClient.Send(message);

       message.Dispose();

   }

On my computer,How do I rewrite that code ?

Matt3.5 : On April 16, 2008 5:35 AM said:

I suggest you visit a site called 4guysfromrolla.com

There you will find several, well written articles, showing you in detail how to send basic - complex emails using the system.net.mail class. The author is Scott Mitchell, a well respected MVP.

cemakpolat : On April 21, 2008 4:00 AM said:

i can't download this video and the others,also i can't watch it.

Diego Vieira : On May 23, 2008 3:49 PM said:

cemakpolat, you just have to click the "Download the video" link and save it to your desktop. To watch the video you can download a codec pack from the internet. Just do a search for "codec pack".

Diego Vieira : On May 26, 2008 1:13 PM said:

Argh.. zip is corrupted.. please fix

download.microsoft.com/.../hilo_contact_final.zip

cinstress2 : On June 01, 2008 3:36 PM said:

How do you get all the data to email.

the code from the example says

Protected Sub Wizard1_FinishButtonClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.WizardNavigationEventArgs) Handles Wizard1.FinishButtonClick

       SendMail(txtEmail.Text, txtComments.Text)

   End Sub

How do you get the ratings and person's name to show up.

I tried adding these in the SendMail area... but it only allows two items.  How do you get all the fields to appear in the email that is sent to you?

mikaelKP : On June 04, 2008 12:19 PM said:

Use

Protected Sub Wizard1_FinishButtonClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.WizardNavigationEventArgs) Handles Wizard1.FinishButtonClick

      SendMail(txtEmail.Text, txtComments.Text, txtName.Text)

  End Sub

You can fill all the txtSomthing.Text as you want

I have no problem with this method:)

cburts : On June 22, 2008 5:53 AM said:

Hello,

I copied the code and config file into a new Asp.Net 3.5 website I created in VB Web Developer Express 2008 and I get an Operation has timed out error after I click the Finish button (takes a long time).  Source error: Line 16 mailClient.Send(message)

Stack Trace:

[SmtpException: The operation has timed out.]

  System.Net.Mail.SmtpClient.Send(MailMessage message) +1948

  _Default.SendMail(String from, String body) in C:\Users\websitepath\Default.aspx.vb:16

  _Default.Wizard1_FinishButtonClick(Object sender, WizardNavigationEventArgs e) in C:\Users\websitepath\Default.aspx.vb:8

  System.Web.UI.WebControls.Wizard.OnFinishButtonClick(Wizard NavigationEventArgs e) +105

  System.Web.UI.WebControls.Wizard.OnBubbleEvent(Object source, EventArgs e) +693

  System.Web.UI.WebControls.WizardChildTable.OnBubbleEvent(Ob ject source, EventArgs args) +17

  System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35

  System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +115

  System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +163

  System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEve ntHandler.RaisePostBackEvent(String eventArgument) +7

  System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11

  System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33

  System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746

David007 : On June 22, 2008 8:13 AM said:

Hi,

I did this with VS2005 and used "localhost". I moved it to 2003 server and works great. I would like to populate the "Summary" section. I've never used the wizzard before.

Please show me how to populate 1 label and I will take it from there !

Thank You in Advance

David007

PS- Love the videos !

dollu : On July 14, 2008 3:16 PM said:

I am getting following error while coding the last page.. Can you help me understand where am I wrong??

The rest of the code is working finr, since I checked it after very next step..

_________________________________________________________

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30203: Identifier expected.

Source Error:

Line 35:     Private Sub SendMail(ByVal from As String, ByVal body As String)

Line 36:         Dim mailServerName As String = "mail.yahoo.com"

Line 37: Dim message As MailMessage = New MailMessage(from. "hi_dollu@yahoo.com". "feedback".body)

Line 38:         Dim mailClient As SmtpClient = New SmtpClient

Line 39:

brooxy28 : On July 14, 2008 9:59 PM said:

Aboriginals.

Leave a Comment

You must be logged in to leave a comment. Click here to log in.

Featured Product

ComponentArt's New AJAX Approach