I have figured out how to send the info from my form to my email but I get 2 emails in my inbox. Is this from postback and how would I fix this. My other problem is I don't even know where to start with getting that same info to insert into my database.
My code for sendmail is:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
'create the mail message
Dim message As New MailMessage()
'set the addresses
message.To.Add("myemail@mysite.com")
'set the content
message.Subject = " Website Contact Form"
message.Body = ("Name: ") & (txtName.Text) & ("<br>") & ("Email: ") & (txtEmail.Text) & ("<br>") & ("How they found us: ") & (txtReferer.Text) & ("<br>") & ("Comments: ") & (txtComments.Text)
'Set the format of the mail message body as HTML
message.IsBodyHtml = True
'Set the priority of the mail message to normal
message.Priority = MailPriority.Normal
'set a new instance of SmtpClient
Dim smtp As New SmtpClient()
'send the message
smtp.Send(message)
pnlForm.Visible = False
pnlSuccess.Visible = True
End Sub
If someone could help that would be great. Thanks.
My code for sendmail is:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
'create the mail message
Dim message As New MailMessage()
'set the addresses
message.To.Add("myemail@mysite.com")
'set the content
message.Subject = " Website Contact Form"
message.Body = ("Name: ") & (txtName.Text) & ("<br>") & ("Email: ") & (txtEmail.Text) & ("<br>") & ("How they found us: ") & (txtReferer.Text) & ("<br>") & ("Comments: ") & (txtComments.Text)
'Set the format of the mail message body as HTML
message.IsBodyHtml = True
'Set the priority of the mail message to normal
message.Priority = MailPriority.Normal
'set a new instance of SmtpClient
Dim smtp As New SmtpClient()
'send the message
smtp.Send(message)
pnlForm.Visible = False
pnlSuccess.Visible = True
End Sub
If someone could help that would be great. Thanks.
-
Re: Contact form using asp.net 2.0
Thu, May 4, 2006 - 5:22 AMWhat database are you using?
Do you have any experience working with a database?