Focus on Microsoft Technologies - Tutorials, Articles, Code Samples.

Saturday, September 02, 2006

ASP.NET - Emailing Form Content

One of the problems that I first encountered when I was learning the ropes was that a book can never tell you everything.

So as I was struggling to learn the development techniques that I apply, I had to frequently rely on online resources or forums to get the job done. This was not easy, especially when you are trying to solve a problem and all you get is errors.

So, one of my goals with my blog was to help all of you out there who are struggling to get on your feet with new technologies. It's kind of like repayment for all those out there who have helped me and still continue to help me learn.

So today, I want to show you how it is possible to email form content to yourself or another person using the postback feature and a little creativity.

I am assuming that your reading this post because you have a form with the runat="server" attribute and well formed server controls already ready to go. Server controls take quite a long time to explain so if you don't already have your form ready to go, I suggest you read up on the many tutorials available that can teach you about server controls.

So how is it possible to do this on the page. Well once you understand how it works, you'll never forget how simple it is.

Dim msg as String

msg+="Form mailer header" & vbcrlf

msg+="Contact Name : " & contactname.Text & vbcrlf

msg+="Contact Email : " & email.Text & vbcrlf

msg+="Agree To Terms : " & terms.SelectedValue & vbcrlf

Continue the full article…

Post a Comment