473,406 Members | 2,713 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Problems with an ASP contact form...

Okay, so I have no knowledge with ASP and I was asked to look at this contact form because the emails aren't delivering.

I'll post the whole page of code, because I am unsure at what is what really apart from the common knowledge stuff i.e. the send email to etc, but this wasn't designed by me so I am unsure if it's wrong or right..

If someone could let me know whether there's a problem with the code or if the problem may lay elsewhere that'd be really handy.

Thanks alot!

Expand|Select|Wrap|Line Numbers
  1.  
  2. <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
  3. <!--#include file="i-functions.asp" -->
  4. <%    
  5. sPageName = "order"
  6. sPageTitle = "Order Form"
  7. %>
  8.  
  9. <%
  10. If Request("Validate") = "Y" then 
  11.  
  12.     nCounter = 0
  13.     sItemsOrdered = Request("item")
  14.     sOrderArray = Split(sItemsOrdered, ",")
  15.     for i = 0 to UBound(sOrderArray)
  16.         nCounter = nCounter + 1
  17.     next
  18.  
  19.  
  20.  
  21.     sFirstName        = Request("FirstName")
  22.     If not containsValue(sFirstName) then 
  23.         Call AddError(sErrorString, "FirstName|")
  24.     End If 
  25.     Session("BuyerFirstName") = sFirstName
  26.     sLastName        = Request("LastName")
  27.     If not containsValue(sLastName) then 
  28.         Call AddError(sErrorString, "LastName|")
  29.     End If 
  30.     Session("BuyerLastName") = sLastName
  31.     sTelephone         = Request("Telephone")
  32.     If not containsValue(sTelephone) then 
  33.         Call AddError(sErrorString, "Telephone|")
  34.     End If 
  35.     Session("BuyerTelephone") = sTelephone
  36.     sMobile         = Request("Mobile")
  37.     sEmail             = Request("Email")
  38.     if not ContainsValue(sEmail) then 
  39.        Call AddError(sErrorString, "Email|")
  40.     elseif (InStr(sEmail, "@") = 0) or (InStr(sEmail, ".") = 0) then 
  41.        Call AddError(sErrorString, "Email|")
  42.     End If 
  43.     Session("BuyerEmail") = sEmail
  44.  
  45.     'sInvAddress1        = Request("InvAddress1")
  46.     'If not containsValue(sInvAddress1) then 
  47.     '    Call AddError(sErrorString, "InvAddress1|")
  48.     'End If 
  49.     'Session("BuyerInvAddress1") = sInvAddress1
  50.     'sInvAddress2        = Request("InvAddress2")
  51.     'Session("BuyerInvAddress2") = sInvAddress2
  52.     'sInvTown            = Request("InvTown")
  53.     'If not containsValue(sInvTown) then 
  54.     '    Call AddError(sErrorString, "InvTown|")
  55.     'End If 
  56.     'Session("BuyerInvTown") = sInvTown
  57.     'sInvCounty            = Request("InvCounty")
  58.     'If not containsValue(sInvCounty) then 
  59.     '    Call AddError(sErrorString, "InvCounty|")
  60.     'End If 
  61.     'Session("BuyerInvCounty") = sInvCounty
  62.     'sInvPostcode        = Request("InvPostcode")
  63.     'If not containsValue(sInvPostcode) then 
  64.     '    Call AddError(sErrorString, "InvPostcode|")
  65.     'End If 
  66.     'Session("BuyerInvPostcode") = sInvPostcode
  67.  
  68.     sDelAddress1    = Request("DelAddress1")
  69.     If not containsValue(sDelAddress1) then 
  70.         Call AddError(sErrorString, "DelAddress1|")
  71.     End If 
  72.     sDelAddress2    = Request("DelAddress2")
  73.     sDelTown        = Request("DelTown")
  74.     If not containsValue(sDelTown) then 
  75.         Call AddError(sErrorString, "DelTown|")
  76.     End If 
  77.     sDelCounty        = Request("DelCounty")
  78.     If not containsValue(sDelCounty) then 
  79.         Call AddError(sErrorString, "DelCounty|")
  80.     End If 
  81.     sDelPostcode    = Request("DelPostcode")
  82.     If not containsValue(sDelPostcode) then 
  83.         Call AddError(sErrorString, "DelPostcode|")
  84.     End If 
  85.  
  86.     sHeardaboutOther= Request("HeardaboutOther")
  87.     sHeardabout        = Request("Heardabout")
  88.     If sHeardabout = "X" then 
  89.         Call AddError(sErrorString, "Heardabout|")
  90.     End If 
  91.     If ((sHeardabout = "Internet Search") and  not containsValue(sHeardaboutOther)) then 
  92.         Call AddError(sErrorString, "HeardaboutOther|")
  93.     End If
  94.     If ((sHeardabout = "Friend") and  not containsValue(sHeardaboutOther)) then 
  95.         Call AddError(sErrorString, "HeardaboutOther|")
  96.     End If
  97.  
  98.  
  99.  
  100.     sRegDate          = MySQLFriendlyDate(Date()) & " " & Time()
  101.  
  102.  
  103.     if not containsValue(sErrorString) then
  104.         sMessage = sMessage & "<html><body><table>"
  105.         sMessage = sMessage & "<tr><td colspan=""2"">The following order details were submitted from the website. </td></tr>"
  106.         sMessage = sMessage & "<tr><td>&nbsp;</td><td>&nbsp;</td></tr>"
  107.         sMessage = sMessage & "<tr><td colspan=""2""><b>Contact Details</b></td></tr>"
  108.         sMessage = sMessage & "<tr><td>Name:</td><td>" & sFirstName & "&nbsp;" & sLastName & "</td></tr>"
  109.         sMessage = sMessage & "<tr><td>Telephone:</td><td>" & sTelephone & "</td></tr>"
  110.         sMessage = sMessage & "<tr><td>Mobile:</td><td>" & sMobile & "</td></tr>"
  111.         sMessage = sMessage & "<tr><td>Email:</td><td>" & sEmail & "</td></tr>"
  112.         sMessage = sMessage & "<tr><td>&nbsp;</td><td>&nbsp;</td></tr>"
  113.         'sMessage = sMessage & "<tr><td colspan=""2""><b>Invoice Address</b></td></tr>"
  114.         'sMessage = sMessage & "<tr><td>Address:</td><td>" & sInvAddress1 & "</td></tr>"
  115.         'If containsValue(sInvAddress2) then 
  116.         '    sMessage = sMessage & "<tr><td>&nbsp;</td><td>" & sInvAddress2 & "</td></tr>"
  117.         'End if
  118.         'sMessage = sMessage & "<tr><td>Town:</td><td>" & sInvTown & "</td></tr>"
  119.         'sMessage = sMessage & "<tr><td>County:</td><td>" & sInvCounty & "</td></tr>"
  120.         'sMessage = sMessage & "<tr><td>Postcode:</td><td>" & sInvPostcode & "</td></tr>"
  121.         'sMessage = sMessage & "<tr><td>&nbsp;</td><td>&nbsp;</td></tr>"
  122.         sMessage = sMessage & "<tr><td colspan=""2""><b>Delivery Address</b></td></tr>"
  123.         sMessage = sMessage & "<tr><td>Address:</td><td>" & sDelAddress1 & "</td></tr>"
  124.         If containsValue(sDelAddress2) then 
  125.             sMessage = sMessage & "<tr><td>&nbsp;</td><td>" & sDelAddress2 & "</td></tr>"
  126.         End if
  127.         sMessage = sMessage & "<tr><td>Town:</td><td>" & sDelTown & "</td></tr>"
  128.         sMessage = sMessage & "<tr><td>County:</td><td>" & sDelCounty & "</td></tr>"
  129.         sMessage = sMessage & "<tr><td>Postcode:</td><td>" & sDelPostcode & "</td></tr>"
  130.         sMessage = sMessage & "<tr><td>&nbsp;</td><td>&nbsp;</td></tr>"
  131.         sMessage = sMessage & "<tr><td>Heard about us?</td><td>" & sHeardabout & "</td></tr>"
  132.         If containsValue(sHeardaboutOther) then 
  133.             sMessage = sMessage & "<tr><td>&nbsp;</td><td>" & sHeardaboutOther & "</td></tr>"
  134.         End if
  135.         sMessage = sMessage & "<tr><td>&nbsp;</td><td>&nbsp;</td></tr>"
  136.         sMessage = sMessage & "<tr><td colspan=""2""><b>Items Ordered</b></td></tr>"
  137.         sMessage = sMessage & "<tr><td colspan=""2"">" & Request("item") & "</td></tr>"
  138.         sMessage = sMessage & "</table></body></html>"
  139.  
  140.         Set objNewMail = Server.CreateObject("CDO.Message")
  141.         objNewMail.Subject = "Website Order Form"
  142.         objNewMail.From = "info@happy-meat.co.uk"
  143.         objNewMail.To = "sales@local-meat.co.uk"
  144.         'objNewMail.To = "frank@designinc.co.uk"
  145.         'objNewMail.To = "jonathan@futuraweb.co.uk"
  146.         objNewMail.HTMLBody = sMessage
  147.         'objMail.BodyFormat = 0 
  148.         objNewMail.Send
  149.         set objNewMail=nothing
  150.  
  151.         'confirmation email to the customer
  152.         sMessage1 = sMessage1 & "Thank you for placing an order through the Really Well Bred Meat Company website.<br> We are currently processing your order and will be contacting you soon to arrange payment and delivery.<br><br>Thanks again,<br>Sammy<br>The Really Well Bred Meat Company"
  153.         Set objNewMail1 = Server.CreateObject("CDO.Message")
  154.         objNewMail1.Subject = "Website Order Form"
  155.         objNewMail1.From = "info@local-meat.co.uk"
  156.         objNewMail1.To = sEmail
  157.         'objNewMail.To = "frank@designinc.co.uk"
  158.         objNewMail1.HTMLBody = sMessage1
  159.         'objMail.BodyFormat = 0 
  160.         objNewMail1.Send
  161.         set objNewMail1=nothing
  162.  
  163.         Response.redirect "ordered.asp"
  164.     Else
  165.     End if 
  166.  
  167. End if 
  168. %>
  169.  
  170. <!--#include file="i-header.asp" -->
  171.  
  172.         <div id="content">
  173.             <div class="minheight"></div>
  174.             <div class="fullcontent">
  175.                 <form name="order" method="POST" action="">
  176.                 <input type="hidden" name="Validate" value="Y" />
  177.                 <div class="fullleft">
  178.                     <h1><%= sPageTitle %></h1>
  179.                     <% if containsValue(sErrorString) then %>
  180.                         <p><span style="color:#FF0000;font-weight:bold;">There are errors. Please complete the fields highlighted in red.</span></p>
  181.                     <% Else %>
  182.                   <% End If %>
  183.                     <h3>Ways to Pay</h3>
  184.                     <p>If you would like to place an order, please choose from one of the following options.</p>
  185.                     <h4>Order Online</h4>
  186.                     <p>Complete and submit the order form on this page.</p>
  187.                     <h4>Order over the Phone</h4>
  188.                     <p>Place an order over the phone by calling <span style="font-weight: bold"> 023 9247 9801</span> or 07834 998 048</p>
  189.                     <h4>Order by Post</h4>
  190.                     <p>Alternatively fill out the order form, print it off and post it to us along with a cheque made payable to The Really Well Bred Meat Co Ltd. Please post your order form to 
  191. The Really Well Bred Meat Co, 40 Acre Farm, Havant Road, Bedhampton, Hants. PO9 3LW. </p>
  192.                   <div class="yellowpanel">
  193.                     <p>To place an order, please type in your requirements below</p>
  194.                     <div align="center">
  195.                       <p>
  196.                         <textarea name="item" cols="30" rows="6"></textarea>
  197.                       </p>
  198.                       <p><br />
  199.                       </p>
  200.                     </div>
  201.                     <div class="clear"></div>
  202.                 </div>
  203.                 </div>
  204.                 <div class="fullright">
  205.                     <fieldset>
  206.                         <h3>Your Details</h3>
  207.                             <div class="formrow">
  208.                                 <label for="FirstName"><% if InStr(sErrorString, "FirstName|") > 0 then %><span style="color:#FF0000;">First name *</span><% Else %>First name *<% End if %></label> <input name="FirstName" type="text" class="text" value="<%= sFirstName %>" />
  209.                                 <div class="clear"></div>
  210.                             </div>
  211.                             <div class="formrow">
  212.                                 <label for="LastName"><% if InStr(sErrorString, "LastName|") > 0 then %><span style="color:#FF0000;">Last name *</span><% Else %>Last name *<% End if %></label> <input name="LastName" type="text" class="text" value="<%= sLastName %>" />
  213.                                 <div class="clear"></div>
  214.                             </div>
  215.                             <div class="formrow">
  216.                                 <label for="Telephone"><% if InStr(sErrorString, "Telephone|") > 0 then %><span style="color:#FF0000;">Telephone number *</span><% Else %>Telephone number *<% End if %></label> <input name="Telephone" type="text" class="text" value="<%= sTelephone %>" />
  217.                                 <div class="clear"></div>
  218.                             </div>
  219.                             <div class="formrow">
  220.                                 <label for="Mobile">Mobile number</label> <input name="Mobile" type="text" class="text" value="<%= sMobile %>" />
  221.                                 <div class="clear"></div>
  222.                             </div>
  223.                             <div class="formrow">
  224.                                 <label for="Email"><% if InStr(sErrorString, "Email|") > 0 then %><span style="color:#FF0000;">Email address *</span><% Else %>Email address *<% End if %></label> <input name="Email" type="text" class="text" value="<%= sEmail %>" />
  225.                                 <div class="clear"></div>
  226.                             </div>
  227.                     </fieldset>
  228.                     <fieldset>
  229.                         <h3>Delivery Address</h3>
  230.                             <div class="formrow">
  231.                                 <label for="DelAddress1"><% if InStr(sErrorString, "DelAddress1|") > 0 then %><span style="color:#FF0000;">Address *</span><% Else %>Address *<% End if %></label> <input name="DelAddress1" type="text" class="text" value="<%= sDelAddress1 %>" />
  232.                                 <div class="clear"></div>
  233.                             </div>
  234.                             <div class="formrow">
  235.                                 <label for="DelAddress2">&nbsp;</label> <input name="DelAddress2" type="text" class="text" value="<%= sDelAddress2 %>" />
  236.                                 <div class="clear"></div>
  237.                             </div>
  238.                             <div class="formrow">
  239.                                 <label for="DelTown"><% if InStr(sErrorString, "DelTown|") > 0 then %><span style="color:#FF0000;">Town *</span><% Else %>Town *<% End if %></label> <input name="DelTown" type="text" class="text" value="<%= sDelTown %>" />
  240.                                 <div class="clear"></div>
  241.                             </div>
  242.                             <div class="formrow">
  243.                                 <label for="DelCounty">County</label> <select name="DelCounty" class="text">
  244.                                     <option value="Hampshire" <% if sDelCounty = "Hampshire" then response.write "selected" %>>Hampshire</option>
  245.                                     <option value="West Sussex" <% if sDelCounty = "West Sussex" then response.write "selected" %>>West Sussex</option>
  246.                                     </select>
  247.                                 <div class="clear"></div>
  248.                             </div>
  249.                             <div class="formrow">
  250.                                 <label for="DelPostcode"><% if InStr(sErrorString, "DelPostcode|") > 0 then %><span style="color:#FF0000;">Postcode *</span><% Else %>Postcode *<% End if %></label> <input name="DelPostcode" type="text" class="text" value="<%= sDelPostcode %>" />
  251.                                 <div class="clear"></div>
  252.                             </div>
  253.                             <div class="formrow">
  254.                                 <label for="Heardabout"><% if InStr(sErrorString, "Heardabout|") > 0 then %><span style="color:#FF0000;">Where did you hear about us? *</span><% Else %>Where did you hear about us? *<% End if %></label> 
  255.                                 <select name="Heardabout" id="Heardabout">
  256.                                     <option value="X">Please select</option>
  257.                                     <option value="Internet Search" <% if sHeardabout = "Internet Search" then response.write "selected" %>>Internet Search</option>
  258.                                     <option value="HTML Email" <% if sHeardabout = "HTML Email" then response.write "selected" %>>HTML Email</option>
  259.                                     <option value="Friend" <% if sHeardabout = "Friend" then response.write "selected" %>>Friend</option>
  260.                                     <option value="Existing Customer" <% if sHeardabout = "Existing Customer" then response.write "selected" %>>Existing Customer</option>
  261.                                     <option value="Advert in Trade Magazine" <% if sHeardabout = "Advert in Trade Magazine" then response.write "selected" %>>Advert in Trade Magazine</option>
  262.                                     <option value="Advert in Newspaper" <% if sHeardabout = "Advert in Newspaper" then response.write "selected" %>>Advert in Newspaper</option>
  263.                                     <option value="Flyer" <% if sHeardabout = "Flyer" then response.write "selected" %>>Flyer</option>
  264.                                     <option value="Van Livery" <% if sHeardabout = "Van Livery" then response.write "selected" %>>Van Livery</option>
  265.                                 </select>
  266.                                 <div class="clear"></div>
  267.                             </div>
  268.                             <div class="formrow">
  269.                                 <label for="HeardaboutOther"><% if InStr(sErrorString, "HeardaboutOther|") > 0 then %><span style="color:#FF0000;">Which search engine / name of friend:</span><% Else %>Which search engine / name of friend:<% End if %></label> <input name="HeardaboutOther" type="text" class="text" value="<%= sHeardaboutOther %>" />
  270.                                 <div class="clear"></div>
  271.                             </div>
  272.                     </fieldset>
  273.                     <p><input type="image" src="images/btn-order.gif" alt="Make payments with PayPal - it's fast, free and secure!" /></p>
  274.                 </div>
  275.                 <div class="clear"></div>
  276.                 <p style="text-align:center;color:#006892;font-size:120%;font-weight:bold;">Alternatively place your order by calling <span style="font-weight: bold"> 023 9247 9801</span> or <span style="font-weight: bold">07834 998 048</span></p>
  277.                 </form>
  278.             </div>
  279.             <div class="clear"></div>
  280.         </div>
  281.  
  282. <!--#include file="i-footer.asp" -->
  283.  
Sep 17 '08 #1
3 2819
jeffstl
432 Expert 256MB
Probably need more information here.

For one, you say the emails aren't delivering. OK. Were they delivering before hand? What changed that they suddenly stopped working?

In other words, did this code ever work before? If it did work, and suddenly stopped working, your problem likely resides with a firewall, or an internal set up, etc.

If the code processes as if nothing is wrong but the email itself just doesn't get delivered then there is probably something on the email server , or firewalls that is the problem.
Sep 17 '08 #2
Probably need more information here.

For one, you say the emails aren't delivering. OK. Were they delivering before hand? What changed that they suddenly stopped working?

In other words, did this code ever work before? If it did work, and suddenly stopped working, your problem likely resides with a firewall, or an internal set up, etc.

If the code processes as if nothing is wrong but the email itself just doesn't get delivered then there is probably something on the email server , or firewalls that is the problem.
Hi, Thanks for the reply. Sorry about the lack of information.

Yes, as far as I know the code was working fine before but now there e-mail's just aren't delivering at all, so when someone fills out the order form and send's it away the e-mail it's supposed to be sent to doesn't receive anything.

I guess if it's a problem on there end then I should advise them of so...

Jerry
Sep 18 '08 #3
jeffstl
432 Expert 256MB
Hi, Thanks for the reply. Sorry about the lack of information.

Yes, as far as I know the code was working fine before but now there e-mail's just aren't delivering at all, so when someone fills out the order form and send's it away the e-mail it's supposed to be sent to doesn't receive anything.

I guess if it's a problem on there end then I should advise them of so...

Jerry
OK well let me be clearer.

This code is executing on a web server. Wherever that web server resides is where the email is coming from (or the same network anyway). So the problem is on the "end" where the website is running and stored.

Also this is just a guess. Server settings and email firewalls or changes to a network firewall are often the culprit in cases like these. Especially when there was no change to the code but it suddenly stops working.
Sep 18 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Eric | last post by:
Hey Everyone.. I have a form that has approximately 7 text fields and 1 checkbox. Generally when this form is submitted(to itself BTW) it works fine, however, when the checkbox is only field...
5
by: Kelli | last post by:
Hi there, I'm wondering if someone can have a quick look at my code and see if there's anything that I've done wrong. This silly script is driving me crazy! <% DIM File, Upload, Count,...
1
by: 3f | last post by:
Hello; We have made a web application that people can download from our web site and installed on: Windows XP Windows 2000 Professional Windows 2003 Server Windows 2000 Server
2
by: mel_palmeruk | last post by:
Hi I am having trouble with ms-access and trying to determind whether or not a row already exisitng in a particular table. I have 3 tables namly Projects, ProjectsAttencedByContact,...
0
by: Scott Emick | last post by:
I have a main entry screen for a contact manager that has some buttons which can launch various other forms and these launch without any problems. I check if the form already exists and set focus...
3
by: KimberlyM | last post by:
This has been driving me crazy. I hope someone can help. The site displays perfectly in FF but all div's do not show in IE. Please help me find the problem! Thanks! Here is my css. ...
0
by: jrnail23 | last post by:
I have a user control which contains an UpdatePanel, which contains a MultiView inside, with a GridView in one of the views. In my GridView, I have a ButtonField which is supposed to trigger a...
6
by: Tomino | last post by:
Hi, I am working on a log in form for an Access 2003 db. Because the built-in jet database engine doesn't supply the ability to record every log attempt, failed attempt, validate passwords, user...
8
by: chromis | last post by:
Hi, I'm writing a contacts section for a cms on a website, I've decided to write the section in OO code. So far I have my Contacts object and a page structure I would use for a procedural site. ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.