First post and glad to be here!

I am doing a project for college. I am stuck on a certain page though and hope you guys/ladies can help.

I have made a form that a user can enter there name(txtName), preferred user name(txtUserName), and preferred password(txtPassword). Also I made a table with several rows and two columns. On the left side there are several institutions and on the right column a drop down list for each institution where the user can select whether they would like to be able to view the specific instition or update information. At the end of the form is a submit button.

Here is the question...When the user clicks submit I want the textbox information entered and any selections made in the ddl's to be emailed to the siteadmin(for example: siteadmin@admin.com). I cannot find anything on the web about how to code that submit button to do something like this and the jargon in the textbook doesn't go this in depth. Any help with the code here would be appreciated!

This is a giant project with several databases, log in page, and all that good stuff and of course I get stuck on this supposedly easy page :(

Thanks

I should probably mention this is being built with Visual Studio 2008 as a asp website.

When the user clicks submit I want the textbox information entered and any selections made in the ddl's to be emailed to the siteadmin(for example: siteadmin@admin.com). I cannot find anything on the web about how to code that submit button to do something like this and the jargon in the textbook doesn't go this in depth. Any help with the code here would be appreciated!

Have a look in the System.Net.Mail namespace in the .NET Framework class library. It provides types you can use to create and send SMTP messages; start with the SmtpClient class. The "remarks" section in the MSDN documentation provides an overview of how to create and send email with SmtpClient.

Of course, you'll need an SMTP server that's available to your application.

Thank you for the reply! One problem here i'm not sure of is how to capture the form to be sent. The user is entering there personal info and selecting random items from drop downs and I want there info and selected choices to be emailed automatically to the site admin when they click the submit button.
Im not sure how to capture the fields and tell the program to email the info.

Im not sure how to capture the fields and tell the program to email the info.

Briefly:

  1. Create a string with values from the drop-down controls; String.Format is useful.
  2. Create a MailMessage object and assign your formatted string to its Body property.
  3. Create an SmtpClient object and use its Send method to send the email.

Read the MSDN documentation I've linked; it should get you on the right track.

Edited 7 Years Ago by gusano79: n/a

This article has been dead for over six months. Start a new discussion instead.