Help - Search - Members - Calendar
Full Version: Need fresh eyes for fixing this code, please take a look
HTMLHelp Forums > Programming > Server-side Scripting
Ougan
Ive made a simple web page and an ASP file to have the form post to an email, for some reason all im getting when i hit submit is a 500 error, I have no clue why, If somone could please take a look at this it would help me out, the code for the ASP is below, the HTML form is attached


<%
'Sends an email
Dim mail
dim date
dim homeOwner
dim community
dim lotNum
dim closeDate
dim streetNum
dim phoneNum
dim altNum
dim subWork
dim subFax
dim vendorNum
dim apptDate
dim itemDesc
dim subConBackCharge
dim csr
dim warMgr
dim csrCon

date = Request.Form("date")

homeOwner = Request.Form("homeOwner")

community = Request.Form("community")

lotNum = Request.Form("Lot")

closeDate = Request.Form("closeDate")

streetNum = Request.Form("streetNumber")

phoneNum = Request.Form("homePhone")

altNum = Request.Form("altPhone")

subWork = Request.Form("subWork")

subFax = Request.Form("subNum")

vendorNum = Request.Form("vendNum")

apptDate = Request.Form("aptDate")

itemDesc = Request.Form("itemDesc")

subConBackCharge = Request.Form("subConBackCharge")

csr = Request.Form("csr")

warMgr = Request.Form("warMgr")

csrCon = Request.Form("csrCon")




response = "(COMPANY NAME), INC. " & vbcrlf
response = response & "WARRANTY WORK ORDER FORM " & vbcrlf


'Shortages Write Section

If date <> "" then
response = response & "Date - " & date & vbcrlf
end if

If homeOwner <> "" then
response = response & "Home Owner - " & homeOwner & vbcrlf
end if

If community <> "" then
response = response & "Community - " & community & vbcrlf
end if
If lotNum <> "" then
response = response & "Lot # - " & lotNum & vbcrlf
end if

If closeDate <> "" then
response = response & "Closing Date - " & closeDate & vbcrlf
end if

If streetNum <> "" then
response = response & "Address - " & streetNum & vbcrlf
end if

If phoneNum <> "" then
response = response & "Home Phone# - " & phoneNum & vbcrlf
end if

If altNum <> "" then
response = response & "Alt Phone# - " & altNum & vbcrlf
end if

If subWork <> "" then
response = response & "Subcontractor Correcting Work - " & subWork & vbcrlf
end if

If vendorNum <> "" then
response = response & "Vendor# - " & vendorNum & vbcrlf
end if

If apptDate <> "" then
response = response & "Date of Appointment - " & apptDate & vbcrlf
end if

If itemDesc <> "" then
response = response & "Description Of Items to be corrected - "& vbcrlf & itemDesc & vbcrlf
end if

If subConBackCharge <> "" then
response = response & "Subcontractor to be back charged (if any) - " & vbcrlf & subConBackCharge & vbcrlf
end if

If response <> "" then
response = response & "If the subcontractor cannot make a scheduled appointment they must notify the warranty technician listed below at least 24 hours in advance in order to advise the homeowner. If the subcontractor is a no-show, or fails to notify, a back-charge will automatically be issued to them. Missed appointments without notification are not acceptable. Customer Service is the number one priority at (company name)." & vbcrlf
end if



If csr <> "" then
response = response & "Date of Appointment - " & csr &vbcrlf
end if

If warMgr <> "" then
response = response & "Warranty Manager - "& warMgr & vbcrlf
end if

If csrCon <> "" then
response = response & "CSR Contact Information - " & csrCon & vbcrlf
end if



Set mail = Server.CreateObject("CDO.Message")
mail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

mail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.(company name).net"


mail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

mail.Configuration.Fields.Update

'==End remote SMTP server configuration section==




mail.To = Request.Form("toEmail")
mail.cc = Request.Form("fromEmail")
mail.From = Request.Form("fromEmail")
mail.Subject = "Warranty Work Order Form"

mail.TextBody = response

mail.Send()
Response.Write("Mail Sent")
'Destroy the mail object!
Set mail = nothing
%>


for the sake of privacy Ive replaced the references to the company name with "(company name)" such as in the mail server
Brian Chandler
I don't speak ASP, but it's the usual answer. You do not need "eyes", you need debugging. What values are being returned here and there. Add 'echo' (in ASP) statements to check what is going on.

Darin McGrew
Also, what messages appear in the server logs?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2014 Invision Power Services, Inc.