Email form script causing error 500

I am trying to get a form working on a site that’s coded in ASP, and although it seems I have built the script to handle the form correctly the way the hosts are suggesting I still get an error,

<FORM name="form1" method="post" action="processcontactform2.asp">
  <INPUT name="companyname" type="text" id="companyname2" size="65">
  <INPUT name="address" type="text" id="companyurl3" size="65">
  <INPUT name="Phone" type="text" id="companyurl3" size="65">
  <INPUT name="Email" type="text" id="email" size="65">
  <INPUT name="contact" type="text" id="Contact" size="65">
 <TEXTAREA name="why" cols="50" rows="8" id="why">
 <INPUT type="submit" name="Submit" value="Submit">
</FORM>

<%
Option Explicit
dim sender_companyname
dim sender_address
dim sender_Phone
dim sender_email
dim sender_contact
dim sender_why

sender_companyname = Request.Form("companyname")
sender_address = Request.Form("address")
sender_Phone = Request.Form("Phone")
sender_email = Request.Form("Email")
sender_contact = Request.Form("contact")
sender_why = Request.Form("why")

BodyText = "Company Name: " & sender_companyname & vbCrLf
BodyText = BodyText & "Address: " & sender_address & vbCrLf  
BodyText = BodyText & "Phone: " & sender_Phone & vbCrLf  
BodyText = BodyText & "Email: " & sender_email & vbCrLf  
BodyText = BodyText & "Contact: " & sender_contact & vbCrLf  
BodyText = BodyText & "Nature of Enquiry: " & sender_why & vbCrLf  

Dim cdoConfig
Set cdoConfig = CreateObject("CDO.Configuration")

With cdoConfig.Fields
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServerPort) = 25
.Item(cdoSMTPServer) = "SMTPMAIL"
.Item(cdoSMTPconnectiontimeout) = 30
.Update
End With

Dim message
Set message= CreateObject("CDO.Message") 

message.Configuration = cdoConfig
message.From = sender_email
message.To = "lee@unotron.com"
message.Subject = "Enquiry from website"
message.HTMLBody = BodyText
message.TextBody = BodyText

message.Send

Response.Redirect "Submitted.htm"

Set message = Nothing
Set cdoConfig = Nothing

%>

What is the error you are getting?

With a cursory glance I noticed you are using the same CSS “id” for two different entities:

  <INPUT name="address" type="text" id="companyurl3" size="65">
  <INPUT name="Phone" type="text" id="companyurl3" size="65">

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.