Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HTML Form > ASPMail processing, need help! 1

Status
Not open for further replies.

JimmyReckless

Technical User
Nov 28, 2004
16
GB
Hey,

I've almost finished building a website for a customer, but they've decided they want a brochure request form on their site. I tried to use Perl, but the new server we're on doesnt support Perl Sendmail. They do have Jmail or ASPMail installed however.

The website is online now:
Now. I've never used ASP before and I'm stuck. I've tried to use a program called FormsToGo by Bebesoft.Com. And I've tried to do it manually using ASPmail, but it just comes up with errors. Here is the ASPmail (Persits) code that FormsToGo generated:


<%
Dim aspEMail
Set aspEMail = Server.CreateObject("Persits.MailSender")

name = request.form("name")
address1 = request.form("address1")
townCity = request.form("townCity")
postcode = request.form("postcode")
telephone = request.form("telephone")
email = request.form("email")

' Redirect user to the error page

If (validationFailed = true) Then

Response.Redirect "error.html"
Response.End

End If

' Owner Email: aspEmail

emailFrom = email
emailSubject = "Brochure Form"
emailBodyText = "name: " & name & "" & vbCrLf _
& "address1: " & address1 & "" & vbCrLf _
& "townCity: " & townCity & "" & vbCrLf _
& "postcode: " & postcode & "" & vbCrLf _
& "telephone: " & telephone & "" & vbCrLf _
& "email: " & email & "" & vbCrLf _
& "" & vbCrLf _
& ""

aspEmail.Host = "10.2.5.10"
aspEmail.Username = "********"
aspEmail.Password = "******"
aspEmail.From = emailFrom
aspEMail.AddAddress "********@btinternet.com", ""
aspEmail.Subject = emailSubject
aspEmail.Body = emailBodyText
aspEmail.Charset = "ISO-8859-1"
aspEmail.ContentTransferEncoding = "quoted-printable"

On Error Resume Next

aspEmail.Send

If Err <> 0 then
Response.Write "aspEmail reported an error sending the email. Error: " & Err.Description
End If

' Redirect user to success page

Response.Redirect "success.html"


' End of ASP script
%>




And this is the HTML Form code:


<form name="brochure" method="post" action="sendform.asp" onSubmit="MM_validateForm('name','','R','telephone','','RisNum','email','','RisEmail');return document.MM_returnValue">
<table width="100%" border="0" cellspacing="5" cellpadding="1">
<tr>
<td width="33%">
<div align="right"><b>Name: </b></div>
</td>
<td width="67%">
<input type="text" name="name" value="" maxlength="50" size="50">
</td>
</tr>
<tr>
<td width="33%">
<div align="right"><b>Address: </b></div>
</td>
<td width="67%">
<input type="text" name="address1" size="50" maxlength="50">
</td>
</tr>
<tr>
<td width="33%">
<div align="right"><b>Town/City: </b></div>
</td>
<td width="67%">
<input type="text" name="townCity" size="50" maxlength="50">
</td>
</tr>
<tr>
<td width="33%">
<div align="right"><b>Postcode:</b> </div>
</td>
<td width="67%">
<input type="text" name="postcode" size="20" maxlength="20">
</td>
</tr>
<tr>
<td width="33%" height="29">
<div align="right"><b>Telephone Number: </b></div>
</td>
<td width="67%" height="29">
<input type="text" name="telephone" size="20" maxlength="20">
</td>
</tr>
<tr>
<td width="33%">
<div align="right"><b>Email Address</b></div>
</td>
<td width="67%">
<input type="text" name="email" size="50" maxlength="50">
</td>
</tr>
</table>
<p align="center"> Where did you hear about us?
<select name="select" size="1">
<option selected>Please select</option>
<option>The Garden</option>
<option>Country Living</option>
<option>Homes &amp; Gardens</option>
<option>House &amp; Gardens</option>
<option>The English Garden</option>
<option>Country Homes &amp; Interiors</option>
<option>Ideal Homes</option>
<option>Internet/Web Search</option>
<option>Other</option>
</select>
</p>
<p align="center">
<input type="radio" name="radiobutton" value="radiobutton">
Brochure
<input type="radio" name="radiobutton" value="radiobutton">
Consultation </p>
<p align="center">
<input type="submit" name="submit" value="Submit">
<input type="reset" name="reset" value="Reset">
</p>
</form>



When I submit the form it just keeps coming up with errors like: Server 500, or 404 Cant find form.

Any ideas anyone on whats going wrong? Im stumped.

Thanks

James
 
<form name="brochure" method="post" action="sendform.asp" onSubmit="MM_validateForm('name','','R','telephone','','RisNum','email','','RisEmail');return document.MM_returnValue">

change it to:

<form name="brochure" method="post" action="sendform.asp">

are you validating using MM_validateForm?? I dont see the function in here...

-DNG

 
I was in Dreamweaver, but I havent put any validation in the ASP Script, is that the problem?
 
just use

<form name="brochure" method="post" action="sendform.asp">

and lets us know whats going on and if you get any errors...

-DNG
 
Its coming up with HTTP Error 404 - File or directory not found after you submit it. Thats with the validation taken off in dreamweaver
 
did you name your asp file sendform.asp and is in the same directory as your form page??

also do this: on internet explorer -> go to tool -> then advanced tab -> then uncheck the box which says "show http friendly error messages...

-DNG
 
The HTML form is named contactUs.html and its form action is set to sendform.asp

sendform.asp is in the same directory ("html") as contactUs.html

The http friendly messages is currently off but its still just showing:

The page cannot be found
The page you are looking for might have been removed, had its name changed, or is temporarily unavailable.
--------------------------------------------------------------------------------

Please try the following:

Make sure that the Web site address displayed in the address bar of your browser is spelled and formatted correctly.
If you reached this page by clicking a link, contact the Web site administrator to alert them that the link is incorrectly formatted.
Click the Back button to try another link.
HTTP Error 404 - File or directory not found.
Internet Information Services (IIS)
 
is your website configured to run asp pages??

i see nothing wrong in your code setup...when you hit submit button on your form, the action page which sendform.asp should get fired...

make sure you can run the asp pages...

write this simple code and name it as test.asp and run it...

<%
response.write "asp pages work"
%>

and see if it writes "asp pages work"...if it gives error then you need to configure to run asp pages...

-DNG
 
Okay,

Yes. If you go on the website now and hit submit, it is coming up with ASP pages work.

Im very confused!

Does it matter that the aspEMail.AddAddress im putting it at the moment is my personal btinternet one and not the catch all info@opusconservatories.co.uk one on the server?

Apart from that, i dont know whats going on
 
see the thing is that even you have something wrong in your sendform.asp page...it should give you error saying incorrect email address or something like that and not the error like "page not found"

let me look into your sendform.asp page...

-DNG
 
ok remove this piece of code from your sendform.asp page...

If (validationFailed = true) Then

Response.Redirect "error.html"
Response.End

End If

and tell what error you get...

-DNG
 
no problem..so what was happening was...since we removed the validation function...we were getting validationFailed==true and the we were getting page error...

now you need to include validation if your mail program is working fine..

i was just making sure that your mail code was working fine...

-DNG
 
what i mean to say is that...once your mail program works fine..put back your validation code back...in both the form and sendform.asp pages...

hope everything works for you

-DNG
 
So far i've got:

Microsoft VBScript compilation error '800a03fd'

Expected 'Case'

/html/sendform.asp, line 26

select = request.form("select")
-------^


---- removing this now
 
And after removing that above, we're back to

HTTP Error 404 - File or directory not found.

That is with the validation bit of code removed, and no validation set on the HTML form.
 
WHOA! no, tell a lie: This came thru to my email box

name: test
address1: Magee
townCity: Horsham
postcode: 234
telephone: 234
email: test@hotmail.com
radiobutton: radiobutton
submit: Submit
reset:

Yay
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top