Try this:
STEP TWO: COPY THIS VBSCRIPT INTO THE HEAD OR BODY OF HTML DOCUMENT
<!-- Beginning of ASP Form-Handler Script -->
<%
'Declare variables for the e-mail script
dim strAddr
dim replyTo
dim strSubject
dim strText
dim check
'Check to see if the form has been submited.
if Trim(Request.form("pageid"))=="1" THEN
'Next, declare itsReady variable so we can trigger e-mail function
'only if user has entered an e-mail address. A real form would
'have a stringent error checking routine
dim itsReady
itsReady = ""
'Get input from the form and assign it to script variables
strAddr = Trim(Request.form("user_email"))
if strAddr <> "" then
replyTo = cstr(strAddr)
end if
strSubject = Request.form("user_subject")
strName = Request.form("user_name")
strMsg = Request.form("user_text")
strText = "E-mail from: " & strName & vbCrLf & "Concerning: " & strMsg
'Note: use vbCrLf (as above) to add line breaks in e-mail message
'Now trigger e-mail function if submitted with a non-blank user_email
if replyTo <> "" then itsReady = send_email()
END IF
'The send_email function formats and sends the e-mail
function send_email()
'Create an object or container for your mail
Dim objMail
Set objMail = Server.CreateObject("CDO.Message")
'Format the e-mail using fields from your HTML form
objMail.To = "you@somewhere.com"
objMail.From = "visitor_form@somewhere.com"
'The From address is a fake address to alert you to
'the origin of the email. You will not reply to it.
objMail.ReplyTo = replyTo
'replyTo is the user_email address from the form
objMail.Subject = strSubject
objMail.TextBody = strText
objMail.Send 'comment out to test script without sending mail
'Release system resources
Set objMail = Nothing
'Book example includes following line; replaced by a Javascript alert box
'Response.Write "<h3>Thank you for using e-mail!</h3>"
if err.number > 0 then
response.write "Errors were encountered in sending your e-mail message. "&_
"Please try again, or contact the <a href='mailto:you@somewhere.com'>webmaster</a>"
else
%>
<script language="JavaScript">
<!--
alert("Your e-mail has been sent!\nThank you for using our e-mail form!");
//-->
</script>
<%
end if
end function
%>
<!-- End of ASP Form-Handler Script -->
STEP 3: COPY THE FORM CODE INTO THE BODY OF HTML DOCUMENT
<!-- Beginning of form -->
<!-- Important: If you change the filename, you must change the form action to match. -->
<script language="JavaScript">
function
validatetheForm) {
if (document.theForm.user_email.value == "")
{
alert("You must enter an e-mail address!");
document.theForm.user_email.focus();
return (false);
}else{
document.theForm.submit();
}
}
</script>
<form method="post" action="mailplay.asp" name="theForm">
<input type="hidden" name="pageid" value="1">
<table border="0"><tr><td align="right">Name: </td><td>
<input type="text" name="user_name" size="20"></td></tr>
<tr><td align="right">E-mail: </td><td>
<input type="text" name="user_email" size="20"></td></tr>
<tr><td align="right">Subject: </td><td>
<input type="text" name="user_subject" size="20"></td></tr>
<tr><td align="right">Question: </td><td><textarea cols="40" wrap="virtual"
rows="3" name="user_text"></textarea></td></tr>
<tr><td> </td><td height="40"><input type=
"button" value="Submit" onclick="validate()">
<input type="reset" value="Clear"></td></tr>
</table>
</form>
You were supposed to have the asp script in a seperated file from the html. I think thats were the problem was. I added some code to allow this so try it and see what happends
