About Ashvin Johnson Expertise I can handle all the queries about File handling, ASP with XML, XSLT, ASP with SQL server 2000 and ASP links.
Experience I have 3 years of experience in Active server pages programming. I have 2 years of experience in .net applications. I have developed many sites in ASP.net. Please mention your platform on which you are working. for e.g. ASP Classic or ASP.NET
Organizations belong to I am working in a Data conversion company. We work for the Internet content preparation. My job is to develope utilities to increase production with accuracy.
Question I am using a simple form in html to move information to email. The .asp program is as follows:
<%
For Each x In Request.Form
message=message & x & ": " & Request.Form(x) & CHR(10)
Next
set smtp = Server.CreateObject("Bamboo.SMTP")
' You only need to change the smtp.Rcpt ans smpt.from part to your email address
smtp.Server = "mail.nwsoccer.net"
smtp.Rcpt = "kgwortman@charter.net"
smtp.From = "webmaster@nwsoccer.net"
smtp.FromName = Request.ServerVariables("HTTP_REFERER")
smtp.Subject = "Your web form - " & Request.ServerVariables("HTTP_REFERER")
smtp.Message = message
on error resume next
smtp.Send
if err then
response.Write err.Description
else
response.Write ("Thank you for your submission.... Your message has been delivered successfully.")
end if
set smtp = Nothing
%>
The above works fine. However, I need to format the email so the information is readble and comes in the email in the order I need it so my programming is below:
<%
Season = Request.Form("Season")
Year = Request.Form("Year")
ClubName = Request.Form("ClubName")
BoysDivision1Only = Request.Form("BoysDivision1Only")
set smtp = Server.CreateObject("Bamboo.SMTP")
' You only need to change the smtp.Rcpt ans smpt.from part to your email address
smtp.Server = "mail.nwsoccer.net"
smtp.Rcpt = "kgwortman@charter.net"
smtp.From = "webmaster@nwsoccer.net"
smtp.FromName = Request.ServerVariables("HTTP_REFERER")
smtp.Subject = "Seasonal Commitment Form - " & Request.ServerVariables("HTTP_REFERER")
smtp.Message = message
on error resume next
smtp.Send
if err then
response.Write err.Description
else
response.Redirect ("http://www.nwsoccer.net/thankyou.htm")
end if
set smtp = Nothing
%>
The problem is, this does not work when the form submit button is hit. Is my syntax incorrect? I have included every form field in the form. I am getting desperite. After several hours, I cannot figure out what is wrong. If you want to see the form itself, it is located at www.nwsoccer.net/seasonalcommitB1test.htm
Thanks for any help you can provide.
Kevin
Answer Hello Kevin,
I am going to tell how to debug problems like this, so please do what I say and you cn solve your problem on your own.
Comment all the Messages from the second code and unComment only
----------------
message = message & "Boys Division 1 Only: " & BoysDivision1Only & VBCrLf
message = message & "Season: " & Season & VBCrLf
message = message & "Year: " & Year & VBCrLf
message = message & "Club Name: " & ClubName & VBCrLf
----------------
This part, If still have same problem then
Comment all the code for the "Request" and uncomment only
---------------------
Season = Request.Form("Season")
Year = Request.Form("Year")
ClubName = Request.Form("ClubName")
BoysDivision1Only = Request.Form("BoysDivision1Only")
---------------------
This code and now execute the page. This is the only method you can debug your code and this practice also helps in long run.