Discussion on Asp.net Contact Form - HTML Email (Bootstrap Edition)


mimtiyaz supports this item


This author's response time can be up to 1 business day.

11 comments found.

Does this send an email to me (the administrator of the form/website) or to the person filling out the form?

When any user tries to contact, an email will be sent to the user and admin as well.

I’m quiet a beginner at this. Unfortunately the help docs provide no real help. Can this form be placed within my regular bootstrap page (ie contact.html)? If so what code do I put there? Is there anything else that I need to be aware of?

Thank you

You need to follow these 3 simple steps

Step 1:
Configure your SMTP settings in your web.config file located in the root directory of your web application.
< smtp deliveryMethod="Network" from="info@domain.com">         
< network defaultCredentials="false" 
< /smtp>
info@domain.com will be the email of your website
domain.com will be your domain
Step 2:
From Default.aspx file
  • Copy the HTML script from BEGIN Container to END Container. You can add or remove text as per your needs.
  • Copy the HTML script from BEGIN JavaScript to END JavaScript. Don’t customize anything here in this area.
Step 3
From Default.aspx.cs file
  • Add the following namespaces
    1. using System.IO;
    2. using System.Net.Mail;
    3. using System.Web.UI;
  • Copy the C# script from #region Send Email to #endregion
That’s all…

Very nice, GLWS!


When opening the solution in VS 2015, I’m getting an error that the project cannot load, and to check the output window. The output window is showing the following error “Error opening web http://localhost:51106. Unable to open the Web site ‘http://localhost:51106'. The Web server ‘http://localhost:51106' could not be found.”

In Visual Studio 2015 go to File-Open Web Site, point it to the directory where your website is located. Once the project is opened, click F5 and see if it works.

Opening as a Web Site solved the issue


How can I fix the email address the form is received. Now the form is going to email which is filled in the email field.

Thank you

Could you be more specific please

When somebody send form I want to receive the result only one mail adress. I want to receive the results to the same emil always. Now somebody get form results who send it.

To receive email as acknowledgement to the sender, simply add message.Bcc.Add(“youremail@domain.com”); after message.To.Add(txtEmail.Text.Trim().Replace(”’”, ”’’”)); in your C# code.

I couldn’t find the style.css, where is it?

Refer to the reply mentioned above. :-)

Where can I add; message.Bcc.Add(“youremail@domain.com”); after message.To.Add(txtEmail.Text.Trim().Replace(”’”, ”’’”)); in your C# code.

in default.aspx ?

In Default.aspx.cs


if i want to use just the captcha, is it possible?

I have a quote widget here https://www.budgetdirect.com.sg/car-insurance and I’m using ReCaptcha. I wanted to try a simplified version but a solid one that will block automated bots from trying to pass through the form.

Can your code blocked bots?

Is it possible for you to provided an updated code that only requires me to add just the captcha into my own form?


Okay, can block the bots and update the code? if so, i’ll purchase the tool.


How to clear all fields after sending of information from form?

Regards Eugenij.


You can clear form fields after the form submission by adding the script mentioned below

After reader.Dispose(); add the following script

txtName.Text = ””; txtEmail.Text = ””; ddlSubject.SelectedValue = “0”; txtMessage.Text = ””;

Thanks, mimtiyaz