mumford
06-01-2007, 09:49 AM
Hi
I have searched for a decent asp form to email script, but cannot find one that is suitable. What I need is:
Email results to a specified email address (dont want this to be a hidden input for spam reasons)
A thankyou page
an error page (validation)
Does anyone know of any good ones?
thanks
Here's a scaled down version I've used.
<%
Dim varName, varEmail, varPhone, varBrowser, varProblem, varSend, thisPage
varName = Request.Form("name")
varEmail = Request.Form("email")
varPhone = Request.Form("phone")
varBrowser = Request.Form("browser")
varProblem = Request.Form("problem")
varSend = Request.Form("send")
thisPage = Request.ServerVariables("SCRIPT_NAME")
If not varSend = 1 Then
%>
<form method="post" action="<%=thisPage%>">
<input name="send" value="1" type="hidden">
<h1>Report Technical Problems</h1>
<p>If you are experiencing problems working with the Reporting System, please provide your daytime contact information and a brief description of the problem, and we will get back to you as soon as possible.</p>
<p>Your name and contact information will remain private, and only be used in solving your technical problem.</p>
<fieldset>
<legend>Report Technical Problems Form</legend>
<div class="row">
<label for="name">Name: </label>
<input type="text" name="name" value="Name" / >
</div>
<div class="row">
<label for="email">Email Address: </label>
<input type="text" name="email" value="Email" / >
</div>
<div class="row">
<label for="phone">Phone: </label>
<input type="text" name="phone" value="Phone" / >
</div>
<div class="row">
<label for="browser">Browser You Are Using: </label>
<select name="browser">
<option selected="selected">Select</option>
<option value="IE">Internet Explorer</option>
<option value="Fx">Firefox</option>
<option value="Safari">Safari</option>
<option value="Opera">Opera</option>
<option value="other">Other</option>
</select>
</div>
<div class="row">
<label for="problem">Please describe the problem:</label><br />
<textarea name="problem" rows="7" cols="75">Problem</textarea>
</div>
<div class="row">
<input type="submit" value="Submit to the IT Team" class="but" / >
</div>
</fieldset>
</form>
<%
Else
varRequest = Replace (varRequest, chr(10), "<br/>")
'Create Mail Object
Dim objMail
Set objMail = Server.CreateObject("CDO.Message")
Set objConfig = CreateObject ("CDO.Configuration")
'Configuration
objConfig.Fields ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.yourdomain.com"
'Update
objConfig.Fields.Update
Set objMail.Configuration = objConfig
'Mail
objMail.From = varName & "<" & varEmail & ">"
objMail.To = "yourname@domain.com"
Dim strSubj
strSubj = "Problem with the Reporting System"
objMail.Subject = strSubj
'Message
objMail.HTMLBody = "<div style=""font-size: .8em; font-family: verdana, sans-serif;"">"_
& VBCrLf & "<p><strong>Name</strong>: " & varName & "</p>"_
& VBCrLf & "<p><strong>Email Address</strong>: " & varEmail & "</p>"_
& VBCrLf & "<p><strong>Phone</strong>: " & varPhone & "</p>"_
& VBCrLf & "<p><strong>Browser</strong>: " & varBrowser & "</p>"_
& VBCrLf & "<p><strong>Problem</strong>: " & varProblem & "</p>"_
& VBCrLf & "</div>"
objMail.Send
'Reset
Set objMail = Nothing
Set objConfig = Nothing
'Confirm
Response.Write "<div style=""margin: 20px;""><h1 style=""font-size: 1.25em;"">Confirmation - <br />Reporting System Technical Problem Report </h1>"_
& VBCrLf & "<p><strong>You have successfully sent a notice to CPE's IT Team of your problem:</strong></p>"_
& VBCrLf & "<blockquote><p>"" & varProblem & ""</p></blockquote>"_
& VBCrLf & "<p>Using this browser: " & varBrowser & "</p>"_
& VBCrLf & "<p><strong>One of the members of our technical staff will be getting back to you shortly.</strong></p></div>"
End If
%>
This prints a confirmation on the same page. I use js to validate, but don't have it handy.
KDLA