I have a small problem with this code that I am using for my web site that will send an email to me using CDONTS. It is used for someone who wishes to purchase a hosting plan with my site and sends me some basic info so i can look at it via an email.
The code is spanned over two pages so far. One page is the form that viewer fills out and the second page builds all the variables, validates the info and sends it using CDONTS. However, when I try this script I made, all it does is sit trying to load after i hit the send button. Is it a problem with my script or a problem with CDONTS itself? The code is pasted below
Page with form:
<script language="JavaScript">
<!--
function isValid(form) {
if (form.Password.value != form.Password2.value) {
alert("Passwords do not match!");
return false;
}
return true;
}
//-->
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000" topmargin="0" leftmargin="0">
<table border="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber21" cellpadding="0" bgcolor="#FFFFFF">
<tr>
<td width="100%">
<img border="0" src="../../images/services/servtab_hosting.jpg"></td>
</tr>
<tr>
<td width="100%">
<form method="POST" action="services_sendform.asp" name="FrontPage_Form1">
<table border="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber22" cellpadding="0">
<tr>
<td width="65%" colspan="2"><u><b><font color="#800000">Contact Info</font></b></u></td>
</tr>
<tr>
<td width="15%"><b><font size="2">Email:</font></b></td>
<td width="50%"><input type="text" name="sender" size="30"></td>
</tr>
<tr>
<td width="15%"><font size="2"><b>Name:</b></font></td>
<td width="50%"><input type="text" name="sendername" size="25"></td>
</tr>
<tr>
<td width="15%"><b><font size="2">Phone number:</font></b></td>
<td width="50%"><b><font size="2">
<input type="text" name="phone" size="15"></font></b></td>
</tr>
<tr>
<td width="65%" colspan="2"><u><font color="#800000"><b>Plan Options</b></font></u></td>
</tr>
<tr>
<td width="15%"><b><font size="2">Domain name:</font></b></td>
<td width="50%">
<input type="text" name="domain" size="25" value="http://"></td>
</tr>
<tr>
<td width="15%"><font size="2"><b>Plan: </b></font></td>
<td width="50%"><font size="2"><b>
<select size="1" name="plan">
<option selected>Choose a plan</option>
<option>Economy Fusion Plan</option>
<option>Standard Fusion Plan</option>
<option>Professional Fusion Plan</option>
<option>Custom Fusion</option>
</select></b></font></td>
</tr>
<tr>
<td width="15%"><font size="2"><b>Administration: </b></font></td>
<td width="50%"><font size="2"><b>
<input type="radio" value="managed" name="admin"></b>Managed by web
host <input type="radio" name="admin" value="remote">Managed remotely</font></td>
</tr>
<tr>
<td width="15%"><font size="2"><b>Options: </b></font></td>
<td width="50%"><font size="2"><b>
<input type="checkbox" name="options" value="FTP_access"></b>FTP
access<br>
<input type="checkbox" name="options" value="add_storage">Additional
storage<br>
<input type="checkbox" name="options" value="add_mailboxes">Extra
mailboxes<br>
<input type="checkbox" name="options" value="webstats">Web statistics<br>
<input type="checkbox" name="options" value="backups">Special backups</font></td>
</tr>
<tr>
<td width="65%" colspan="2"><u><font color="#800000"><b>Account Info</b></font></u></td>
</tr>
<tr>
<td width="15%"><b><font size="2">Title of website:</font></b></td>
<td width="50%">
<input type="text" name="webname" size="20"></td>
</tr>
<tr>
<td width="15%"><b><font size="2">Password:</font></b></td>
<td width="50%">
<input type="password" name="password" size="20"></td>
</tr>
<tr>
<td width="15%"><b><font size="2">Verify password:</font></b></td>
<td width="50%">
<input type="password" name="password2" size="20"></td>
</tr>
<tr>
<td width="65%" colspan="2"><b><font size="2">Additional comments or
requests below:</font></b><br>
<textarea rows="10" name="comments" cols="50"></textarea></td>
</tr>
<tr>
<td width="65%" colspan="2">
<p align="center"><input type="submit" value="Submit" name="B1">
<input type="reset" value="Reset" name="B2"></td>
</tr>
</table>
<input type="hidden" name="failure" value="">
</form>
</td>
</tr>
<tr>
<td width="100%"> </td>
</tr>
</table>
Here's the page that sends the e-mail
<%
' ## FORM VALUES ##
' sendername From (Name) (If omitted shows: sender address)
' sender From (required)
' recipient To (required)
' subject Email Subject (If omitted shows: No subject)
' comment User definded body text (If omitted shows: No message)
' failure Page to show if there is a problem. Default is this script (see bottom). Must be web location of file to show
'
' First prevent this file being displayed without submitting data
' Delete this to remove post protection
If LCase(Request.ServerVariables("REQUEST_METHOD")) <> "post" Then
Response.Redirect(Request.ServerVariables("URL") & "?prob=post")
End If
' ## VALUES ##
' Form values
sender = Trim(request("sender")) 'From
sendername = request("sendername") 'From (Name)
recipient = "webfusionnet@comcast.net" 'To
subject = "Hosting for: " & request("webname") 'Email Subject
phone = request("phone")
domain = request("domain")
plan = request("plan")
admin = request("admin")
options = request("options")
webname = request("webname")
password = request("password")
password2 = request("password2")
comment = request("comment") 'User definded body text
failure = request("failure") 'Page to show if there is a problem. Default is the referring page.
' ## ADDRESS CHECK ##
' Check that there is a valid email address for the "sender" fields
If Len(sender) = 0 Or Instr(sender, "@") = 0 Or Instr(str_sender, ".") = 0 Then
Response.Redirect(failure & "?prob=sender")
End If
message = "HOSTING PLAN FROM WEB FUSION NETWORKS" & vbcrlf & vbcrlf & "Name: " & sendername & vbcrlf & "E-mail: " & sender & vbcrlf & "Phone: " & phone & vbcrlf & vbcrlf & "Domain: " & domain & vbcrlf & "Hosting Plan: " & plan & vbcrlf & "Administration: " & admin & vbcrlf & "Options: " & options & vbcrlf & vbcrlf & "Website Title: " & webname & vbcrlf & "Password: " & password
details = "Host: " & request.ServerVariables("REMOTE_ADDR") & vbcrlf & "Referer: " & request.ServerVariables("HTTP_REFERER") & vbcrlf & "Time/Date: " & Now
' ## SENDING EMAIL ##
' Setup CDONTS Email to be sent
Set objNewMail = Server.CreateObject("CDONTS.NewMail")
objNewMail.From = sendername & "<" & sender & ">"
objNewMail.Subject = subject
objNewMail.To = recipient
objNewMail.Body = message & vbcrlf & vbcrlf & comment & vbcrlf & vbcrlf & details
objNewMail.Send ' Send it
Set objNewMail = Nothing ' Destroy the sent email %>
<html>
<head>
<title>Email sending details</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../Style/styles.css">
<meta name="Microsoft Border" content="tlrb">
</head>
<body bgcolor="#FFFFFF" text="#000000" topmargin="0" leftmargin="0">
<% If Request.QueryString("prob") = "" Or Len(Request.QueryString("prob")) < 1 Then %>
<table border="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" cellpadding="0" bgcolor="#FFFFFF">
<tr>
<td width="100%">
<img border="0" src="../../images/services/servtab_hosting.jpg"></td>
</tr>
<tr>
<td width="100%"><u><b>
<font face="Arial, Helvetica, sans-serif" color="#800000">Email sent successfully!</font></b></u></td>
</tr>
<tr>
<td width="100%">Name: <b><%= sendername %></b><br>
E-mail: <b><%= sender %></b><br>
Phone: <b><%= phone %></b>
<p>Domain: <b><%= domain %></b><br>
Hosting plan: <b><%= plan %></b><br>
Administration: <b><%= admin %></b><br>
Options: <b><%= options %></b></p>
<p>Website title: <b><%= webaname %></b><br>
Password: <b><%= password %></b></p>
<p>Comments: <b><%= Replace(Server.HTMLEncode(comment),Chr(13),"<br>") %></b></td>
</tr>
<tr>
<td width="100%">
<% ElseIf Request.QueryString("prob") = "Sender" Then %>
<font face="Arial, Helvetica, sans-serif" size="2" color="red"><b>There was a problem with the senders address, please go back and try again.</b></font>
<% ElseIf Request.QueryString("prob") = "post" Then %>
<font face="Arial, Helvetica, sans-serif" size="2" color="red"><b>You must post data to this script in order for anything to be mailed to the appropriate recipient.</b></font>
</td>
</tr>
<tr>
<td width="100%"><a href="../../services.htm">
<img border="0" src="../../images/backtopage.jpg">Back to the hosting plans</a></td>
</tr>
</table>
<% End If %>
**Note some of the code is cut off because it was not necessary to paste here
Thanks for the help if anyone knows anything about this.