Form to Email ASP

Drone-7

New Member
Hi there, I'm doing a website for a company I work for and I need to have data from a form sent to our email address without the usual outlook express opening. I'm having issues with the coding, so here's the deal. The form gathers info from the customer, and gives them a quote for their lawn dimensions after they hit submit. For my form, after I enter info and hit submit, it either says page cannot be displayed or tries to open the code as a file. Here's the code:

Form


<FORM ACTION="formtomail.asp" METHOD=post>

<table width="75%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>name:</td>
<td colspan="2">
<input type="text" name="name">
</td>
</tr>
<tr>
<td>email:</td>
<td colspan="2">
<input type="text" name="email">
</td>
</tr>
<tr>
<td>message:</td>
<td colspan="2">
<textarea name="message" cols="40" rows="5"></textarea>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="2">
<input type="submit" name="Submit" value="Submit">
<input type="reset" name="Reset" value="Reset">
</td>
</tr>
</table>

<INPUT TYPE=submit value="Submit">
</FORM>


Code
formtomail.asp
<%
For Each x In Request.Form
message = message & x & ": " & Request.Form(x) & CHR(10)
Next
set smtp=Server.CreateObject("Bamboo.SMTP")
smtp.Server="[email protected]"
smtp.Rcpt="[email protected]"
smtp.From="[email protected]"
smtp.FromName="Joe Smith"
smtp.Subject="Response to my form"
smtp.Message = message
on error resume next
smtp.Send
if err then
response.Write err.Description
else
Response.redirect ("http:// redirect.com")
end if
set smtp = Nothing
%>

Im sure my SMTP is wrong, but I really only need help with placement of the script, but any suggestions would be appreciated...tell me what I dont know.

Any help would be awesome.

Thanks.
 

thrive

New Member
Your server is not configured properly if it's trying to give you the asp file as a download. Make sure running scripts in enabled.
 

Drone-7

New Member
Re: ASP and PHP

Yeah I was informed that our network guys disabled PHP and ASP for some unknown reason, but until they get on it, I decided to use PHP for my script, but basically what we want to do is when the visitor hits the submit button to get their free estimate, we want that info to be sent to us so we can follow up with them. So in a nutshell, I want the submit button to calculate their estimate via javascript and send the info to us at the same time. Any thoughts? I'll compensate anyone who helps me get this script workin' via Paypal.

Thanks.
 

thrive

New Member
You need some kind of scripting language enabled on the server first. You can't do this with html/JavaScript.
 
Top