Contact form using asp.net 2.0

topic posted Wed, May 3, 2006 - 7:09 AM by  Grant
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.
posted by:
Grant
Florida

Recent topics in "ASP.net web development"

Topic Author Replies Last Post
graphics in asp Toby 0 August 9, 2008
Does anybody know? Grant 2 January 2, 2008
How to create asp.net pages dynamically? Grant 1 January 2, 2008
question about isPostBack Eira 3 November 2, 2007