If I understand fully, you have a page where a registrant will fill out, click a button, and upon submission, it will also send a confirmation email.
There is two quick & easy ways of doing this.
First, you will need to use the "System.Net.Mail.SmtpClient class".
- Dim smtp as new System.Net.Mail.SmtpClient(<--server address goes here-->)
Second, you will need a message to be sent. This will derive from the System.Net.Mail.MailMessage class.
- Dim msg As New Net.Mail.MailMessage(<--from-->, <--to who-->)
Next, set the subject for this email by:
- msg.Subject = <-something->
Next, enable html within the message by settings .IsBodyHtml.
Now, you're ready for the body or content, so choose your way:
Option 1) Storing HTML content prewritten in a String
store the html of the content (body) of the email in a string
- some string = "<body><table><tr><td> hello!</td></tr></table>...."
Option 2) Provide another page (or view) which it's HTML will be used)
use an ASP.NET Multiview control and upon the click event (submission), send them from View1 to View2 which will hold in a Panel control the contents of the email's body.
You will then need to "rip" the html of the contents in that panel to send. This can easily be done by using a string builder & writer:
Dim str As String = "" 'declare the string
Dim sb As New StringBuilder 'declare the string builder
Dim sw As New IO.StringWriter(sb) 'declare the string writer
Dim hw As New HtmlTextWriter(sw) 'declare the html writer
View2.RenderControl(hw) 'now do the magic!
msg.Body = sb.ToString 'and set the body toexactly this.
Wahh lahh! Send it and your done!