Skip to main content
May 18, 2007
Answered

asp code send email from form

  • May 18, 2007
  • 1 reply
  • 361 views
have asp page (just testing to learn and get it correct) with a form and code to send email.
it sends the email on page load, and i want it to send only one email when the page submits. what addition to the code do i need?

thanks for any help
jim balthrop
This topic is closed to new replies. Start a new post to keep the conversation going.
Correct answer
found this answer on a thread in the UK. might help someone else.
only sends one email when form submit button is pressed.

added this code

if request.form("submit1") = "Send Form" then
'where submit1 is name of submit button and Send Form is value of submit button

ObjSendMail.To = "jimb@jbwebworks.com"
ObjSendMail.Subject = "check entry form database"
ObjSendMail.From = "pco@pcogolf.org"

' we are sending a text email.. simply switch the comments around to send an html email instead
ObjSendMail.HTMLBody = request.form("_email")

ObjSendMail.Send

Set ObjSendMail = Nothing

'also needed to add this
end if
%>

1 reply

Correct answer
May 30, 2007
found this answer on a thread in the UK. might help someone else.
only sends one email when form submit button is pressed.

added this code

if request.form("submit1") = "Send Form" then
'where submit1 is name of submit button and Send Form is value of submit button

ObjSendMail.To = "jimb@jbwebworks.com"
ObjSendMail.Subject = "check entry form database"
ObjSendMail.From = "pco@pcogolf.org"

' we are sending a text email.. simply switch the comments around to send an html email instead
ObjSendMail.HTMLBody = request.form("_email")

ObjSendMail.Send

Set ObjSendMail = Nothing

'also needed to add this
end if
%>