SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: Mail Form Help

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Sep 2010
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Mail Form Help

    Hey All ...

    I used to use this mail form before ... it used to work without any problems until my host "godaddy" upgraded to II7. Now it only gets a "505 Internal service error" ...

    I don't know anything about programming or debugging, I only know few things about html ... So if anyone can help it's verrrrrrrrry much appreciated ... Thank you in advance ...

    That's the script ...

    Code ASP:
    <tr style="height:10px">
    <td></td>
    </tr>
    <tr>	
    <td>
    <table width="100%" border="0" cellpadding="0" cellspacing="0">
    		<%
    		If request.form("actionIs")<>"" then
    		form_validated=true
    		strEmail = request.form("email")
    		If request.form("name") ="" then
    		msgname = "<tr><td colspan='2' align='left' class='normal_bold_grey_light'>***Please Enter Your Name..</td></tr>"
    		form_validated=false
    		end if
    		If request.form("email")="" or request.form("phone")="" then
    		msgcontact = "<tr><td colspan='2' align='left' class='normal_bold_grey_light'>***Please Enter Contact Info..</td></tr> "
    		form_validated=false
    						end if
    						if strEmail <> "" and inStr(strEmail,"@") = 0 and inStr(strEmail,".") = 0 then
    						'If request.form("email") <> "" and inStr(request.form("email"),"@") <> 0  AND inStr(request.form("email"),".") <> 0 then
    							msgemail = "<tr><td colspan='2' align='left' class='normal_bold_grey_light'>***Please Enter a Valid Email..</td></tr>"
    							form_validated=false
    						end if
    						If request.form("message") ="" then
    						msgmsg = "<tr><td colspan='2' align='left' class='normal_bold_grey_light'>***Please Enter Your Message Here..</td></tr>"
    						form_validated=false
    						end if
    						If request.form("contType") ="" then
    						msgtype = "<tr><td colspan='2' align='left' class='normal_bold_grey_light'>***Please Enter Your Reason Of Contact ..</td></tr>"
    						form_validated=false
    						end if
    						End IF
    						If not form_validated or request.form("actionIs")="" then
    						'response.write "oooooops"
    						'else
    						'response.write "ok"
    						'end if
    						%>
    						<%'If request.form("actionIs")="" then%>
     
    		<form action="<%=request.serverVariables("script_name")%>#contact" method="post" name="contactForm">
     
    <%=msgname%>
    <tr style="height:25px">
    	<td width="170" valign="top" class="normal_bold_green" align="left" style="padding-top:3px">NAME</td>
    	<td class="FP" valign="top" align="left"><input name="name" type="text" class="form" size="35" style="width:540px;background-color:#ffffff;border:1px;border:1 #326431 solid" value="<%=request.form("name")%>" /></td>
    </tr>
     
    <%=msgcontact%>
    <tr style="height:25px">
    	<td valign="top" class="normal_bold_green" align="left" style="padding-top:3px">PHONE/MOBILE</td>
    	<td class="FP" valign="top" align="left"><input name="phone" type="text" class="form" size="35" style="width:540px;background-color:#ffffff;border:1px;border:1 #326431 solid" value="<%=request.form("phone")%>" /></td>
    </tr>
     
    <%=msgemail%>
    <tr style="height:25px">
    	<td valign="top" class="normal_bold_green" align="left" style="padding-top:3px">EMAIL</td>
    	<td class="FP" valign="top" align="left"><input name="email" type="text" class="form" size="35" style="width:540px;background-color:#ffffff;border:1px;border:1 #326431 solid" <%If msgemail="" then%>value="<%=request.form("email")%>"<%End IF%> /></td>
    </tr>
     
    <%=msgtype%>
    <tr style="height:25px">
    	<td valign="top" class="normal_bold_green" align="left" style="padding-top:3px">CONTACT TYPE</td>
    	<td class="FP" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
    <tr>
    	<td align="left" width="50" class="normal_bold_green"><input name="contType" type="radio" value="comment" class="INPUT_none" <%If request.form("contType")="comment" then%>checked<%end if%> />Comment</td>
    	<td align="left" width="50" class="normal_bold_green"><input name="contType" type="radio" value="question" class="INPUT_none" <%If request.form("contType")="question" then%>checked<%end if%> />Question</td>
    <!--</tr>
    <tr>-->
    	<td align="left" width="50" class="normal_bold_green"><input name="contType" type="radio" value="complaint" class="INPUT_none" <%If request.form("contType")="complaint" then%>checked<%end if%> />Complaint</td>
    	<td align="left" width="50" class="normal_bold_green"><input name="contType" type="radio" value="suggestion" class="INPUT_none" <%If request.form("contType")="suggestion" then%>checked<%end if%> />Suggestion</td>
    </tr>
    </table>
    </td>
    </tr>
     
    <%=msgmsg%>
    <tr>
    	<td valign="top" class="normal_bold_green" align="left" style="padding-top:3px">MESSAGE</td>
    	<td class="FP" valign="top" align="left"><textarea name="message" class="textarea" cols="30" rows="5" style="width:540px;background-color:#ffffff;border:1 #326431 solid;overflow:hidden"><%=request.form("message")%></textarea></td>
    </tr>
     
    <tr style="height:5px">
    	<td class="space" colspan="2"></td>
    </tr>
     
    <tr style="height:25px">
    	<td></td>
    	<td align="center" valign="middle" class="FPbold"><input type="submit" name="submit" value="SUBMIT" style="width:100px;background-color:#ffffff;border:1 #326431 solid" /></td>
    </tr>
    <input type="hidden" name="actionIs" value="submitted" />
    </form>
     
    <%else%>
    						<%
    						Set myMail=CreateObject("CDO.Message")
    						myMail.Subject="MBOLAW Form :: "& request.form("contType")
    						myMail.From="website@mbo-law.com"
    						myMail.To="r.gazzar@grafica-egy.com"
    						TheBody = TheBody &"<font face=verdana color=navy size=3><strong>MBOLAW</strong></font>" 
    						TheBody = TheBody &"<font face=verdana color=navy size=2><br />--------------------------------------------"
    						TheBody = TheBody &"<br />This <strong>"&request.form("contType")&"</strong> Was Sent Through <font color=red>MBOLAW Website Feedback Form</font> from:-" 
    						TheBody = TheBody &"<br /><strong>Name    : </strong>"& request.form("name")
    						TheBody = TheBody &"<br /><strong>Phone   : </strong>"& request.form("phone")
    						TheBody = TheBody &"<br /><strong>Email   : </strong>"& request.form("email")
    						TheBody = TheBody &"<br /><strong>Message : </strong>"& request.form("message")
    						TheBody = TheBody &"<br /><strong>Date    </strong>: "& Date()
    						TheBody = TheBody &"<br />------------------------------------------</font>"
    						TheBody = TheBody &"<br /><font face=verdana color=navy size=1>* For Any Comments On The Website Feedback Mails, Please Contact <a href='http://www.grafica-egy.com.com/'>grafica-egy.com</a></font>"
    						myMail.HTMLBody = TheBody
    						With myMail.Configuration.Fields
              					.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
              					.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtpout.secureserver.net"
              					.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "website@mbo-law.com"
              					.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "mail password inserted" 
             		 			.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
              					.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 80
              					.Update
    						End With
    						myMail.Send
    						set myMail=nothing
    						%>
     
     
    <tr style="height:10px">
    							<td class="space" colspan="2"></td>
    						</tr>
    						<tr style="height:20px">
    							<td colspan="2" align="right" class="normal_bold_green">*** Your <%=request.form("contType")%> has been submitted..
    							<br />Thank You...</td>
    						</tr>
    						<tr style="height:20px">
    							<td colspan="2"></td>
    						</tr>
    						<tr>
    							<td width="150" valign="top" class="normal_bold_green" align="left">NAME</td>
    							<td class="normal_bold_grey_light" valign="top" align="left"><%=request.form("name")%></td>
    						</tr>
    						<%=msgcontact%>
    						<tr>
    							<td valign="top" class="normal_bold_green" align="left">PHONE/MOBILE</td>
    							<td class="normal_bold_grey_light" valign="top" align="left"><%=request.form("phone")%></td>
    						</tr>
    						<%=msgemail%>
    						<tr>
    							<td valign="top" class="normal_bold_green" align="left">EMAIL</td>
    							<td class="normal_bold_grey_light" valign="top" align="left"><%=request.form("email")%></td>
    						</tr>
    						<%=msgtype%>
    						<tr>
    							<td valign="top" class="normal_bold_green" align="left">CONTACT TYPE</td>
    							<td class="normal_bold_grey_light" valign="top" align="left"><%=request.form("contType")%></td>
    						</tr>
    						<tr>
    							<td valign="top" class="normal_bold_green" align="left">MESSAGE</td>
    							<td class="normal_bold_grey_light" valign="top" align="left"><%=request.form("message")%></td>
    						</tr>
    						<tr style="height:20px">
    							<td class="space" colspan="2"></td>
    						</tr>
    						<%end if%>
    						</table></td>	
    					</tr>
    					<tr style="height:10px">
    						<td></td>
    					</tr>
    Last edited by Mittineague; Sep 28, 2010 at 13:02. Reason: reformatting bbcode tags

  2. #2
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,631
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    If you try this form page using Firefox (for example, rather than IE) do you see a proper error message? If not then you'll need to get GoDaddy to check their server logs and advise the real error message.
    Ian Anderson
    www.siteguru.co.uk

  3. #3
    SitePoint Member
    Join Date
    Sep 2010
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you so much for replying Ian ...

    Upon your advice I tried: Explorer / Firefox / Opera / Chrome / Safari
    The Message Displayed:
    "500 - Internal server error.
    There is a problem with the resource you are looking for, and it cannot be displayed."

    Godaddy support replied: (But I truly don't know where to insert the code they sent or what is the web.config)

    "This error indicates an issue with your web.config file or website scripting. We advise that you use the following information to enable custom errors which will make the browser provide additional error details that can be used to troubleshoot the issue. By default, our Windows hosting servers display a generic error when any .NET application generates an exception. We display a generic error because the detailed error messages allow a malicious user to obtain sensitive information. To troubleshoot the error, you can modify your web.config file and specify that a custom error message displays. A custom error message helps you to locate the specific code that is causing the issue."

    Enabling Custom Error Messages on IIS 7

    Use the sample code below to display custom error messages on IIS 7:

    Code ASP:
    <configuration>
        <system.webServer>
            <httpErrors errorMode="Detailed" />
            <asp scriptErrorSentToBrowser="true"/>
        </system.webServer>
        <system.web>
            <customErrors mode="Off"/>
            <compilation debug="true"/>
        </system.web>
    </configuration>

  4. #4
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,631
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    OK. If your code previously worked correctly (before the server change) then this tells us that this is a server configuration issue - maybe the CDO email component has not been loaded on the new server? Or user account details for emails have changed? The only way of determining this is to find the real error message.

    The fact you get the 500 error with other browsers means that it is the web server configuration that is sending a general error. This is not unusual with default IIS7 installs.

    The web.config file is something that relates to .NET technology, not classic ASP. I believe the web.config file is stored in your server webroot folder, but I have no idea whether the code provided would work to send ASP error messages to the browser - ASP does not use the .NET framework at all. However it wouldn't hurt to try - just copy the code shown into a text editor and save it as web.config; upload this file to your website's main (root) folder.

    Good luck!
    Ian Anderson
    www.siteguru.co.uk


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •