Form sends email for every page load

Please support our ASP advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
Reply

Join Date: Jun 2009
Posts: 2
Reputation: nukedfood is an unknown quantity at this point 
Solved Threads: 0
nukedfood nukedfood is offline Offline
Newbie Poster

Form sends email for every page load

 
0
  #1
Jun 20th, 2009
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:

  1. Dim objConfig ' As CDO.Configuration
  2. Dim objMessage ' As CDO.Message
  3. Dim Fields ' As ADODB.Fields
  4. Dim title, firstname, surname, email, confirmemail, reason, other, enquiry
  5.  
  6. title = Request.Form("title")
  7. firstname = Request.Form("firstname")
  8. surname = Request.Form("surname")
  9. email = Request.Form("email")
  10. confirmemail = Request.Form("confirmemail")
  11. reason = Request.Form("reason")
  12. other = Request.Form("other")
  13. enquiry = Request.Form("enquiry")
  14.  
  15. ' Get a handle on the config object and it's fields
  16. Set objConfig = Server.CreateObject("CDO.Configuration")
  17. Set Fields = objConfig.Fields
  18.  
  19. ' Set config fields we care about
  20. With Fields
  21. .Item(cdoSendUsingMethod) = cdoSendUsingPort
  22. .Item(cdoSMTPServer) = "smtp.somesite.co.uk"
  23. .Item(cdoSMTPServerPort) = 25
  24. .Item(cdoSMTPConnectionTimeout) = 10
  25. .Item(cdoSMTPAuthenticate) = cdoBasic
  26. .Item(cdoSendUserName) = "me@somesite.co.uk"
  27. .Item(cdoSendPassword) = "password"
  28.  
  29. .Update
  30. End With
  31.  
  32. Set objMessage = Server.CreateObject("CDO.Message")
  33.  
  34. Set objMessage.Configuration = objConfig
  35.  
  36. With objMessage
  37. .To = "someone@something.com"
  38. .From = "someone@something.co.uk"
  39. .Subject = "Customer Enquiry"
  40. .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
  41. .Send
  42.  
  43. End With
  44.  
  45. Set Fields = Nothing
  46. Set objMessage = Nothing
  47. Set objConfig = Nothing
  48. %>

Does anyone have any ideas?

Cheers.
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 23
Reputation: chsab420 is an unknown quantity at this point 
Solved Threads: 5
chsab420 chsab420 is offline Offline
Newbie Poster

Re: Form sends email for every page load

 
0
  #2
Jun 25th, 2009
do u want to send email when he clicks submit button
if so please give ur html code as well
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC