Hi, I built a form to send customer info and used some ASP I found on the internet so I'm quite new to it. I got it to send the info I want but I recieve an e-mail every time I navigate away from the page not using the submit button. Here's the ASP I'm using to do it with:

Dim objConfig  ' As CDO.Configuration
Dim objMessage ' As CDO.Message
Dim Fields     ' As ADODB.Fields
Dim title, firstname, surname, email, confirmemail, reason, other, enquiry

title = Request.Form("title")
firstname = Request.Form("firstname")
surname = Request.Form("surname")
email = Request.Form("email")
confirmemail = Request.Form("confirmemail")
reason = Request.Form("reason")
other = Request.Form("other")
enquiry = Request.Form("enquiry")

' Get a handle on the config object and it's fields
Set objConfig = Server.CreateObject("CDO.Configuration")
Set Fields = objConfig.Fields

' Set config fields we care about
With Fields
	.Item(cdoSendUsingMethod)       = cdoSendUsingPort
	.Item(cdoSMTPServer)            = "smtp.somesite.co.uk"
	.Item(cdoSMTPServerPort)        = 25
	.Item(cdoSMTPConnectionTimeout) = 10
	.Item(cdoSMTPAuthenticate)      = cdoBasic
	.Item(cdoSendUserName)          = "me@somesite.co.uk"
	.Item(cdoSendPassword)          = "password"

	.Update
End With

Set objMessage = Server.CreateObject("CDO.Message")

Set objMessage.Configuration = objConfig

With objMessage
	.To       = "someone@something.com"
	.From     = "someone@something.co.uk"
	.Subject  = "Customer Enquiry" 
	.TextBody = "SMTP Relay Test Sent @ " & Now() & vbCrLf & "title: " & title & vbCrLf & "firstname: " & firstname & vbCrLf & "surname: " & surname & vbCrLf & "email: " & email & vbCrLf & "confirmemail: " & confirmemail & vbCrLf & "reason: " & reason & vbCrLf & "other: " & other & vbCrLf & "enquiry: " & enquiry 
	.Send
	
End With

Set Fields = Nothing
Set objMessage = Nothing
Set objConfig = Nothing
%>

Does anyone have any ideas?

Cheers.

do u want to send email when he clicks submit button
if so please give ur html code as well

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