email form won't submit

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jennifer6601
    New Member
    • May 2010
    • 3

    email form won't submit

    Hello. I am new to this forum as well as to ASP and need some help with a simple email form for a website I've developed.

    I have a simple html email form that is processed with an ASP script using the POST method, that should redirect to an html thank you page upon successful submission of the form. All three pages currently reside on a server and the site is live, so I am accessing the form from the live website to test it. The ASP script currently uses my own email address for testing purposes. I do not receive the emails, which I'm sure you've figured out.

    When I hit the submit button I get an HTTP 500 Internal Error message that says the "Website cannot diplay the page." I've talked to the hosting company and they assure me that permissions are set correctly.

    I've been troubleshooting this form for weeks and have gone from specific script/syntax errors to the HTTP 500 server error, and have hit a brick wall. If anyone can tell me what I've done wrong or need to do to fix the script I would greatly appreciate it. Here is my ASP script page...

    Code:
    <%@LANGUAGE="VBSCRIPT"%>
    <% 
    Dim objConfig  ' As CDO.Configuration
    Dim objMessage ' As CDO.Message
    Dim Fields     ' As ADODB.Fields
    Dim contact, company, email, phone, businessType, comments
    
    contact = Request.Form("contact")
    company = Request.Form("company")
    email = Request.Form("email")
    phone = Request.Form("phone")
    businessType = Request.Form("businessType")
    comments = Request.Form("comments")
    
    ' Get a handle on the config object and it's fields
    Set objConfig = Server.CreateObject("CDO.Configuration")
    Set Fields = objConfig.Fields
    
    ' Set config fields we care about
    	
    	.Item(cdoSMTPServer)            = "mail.xyz.com"
    	.Item(cdoSMTPServerPort)        = 25
    	.Item(cdoSMTPConnectionTimeout) = 10
    	.Item(cdoSMTPAuthenticate)      = cdoBasic
    	.Item(cdoSendUserName)          = "emailcontactus@xyz.local"
    	.Item(cdoSendPassword)          = "emailus101"
    
    
    Set objCDOMail = Server.CreateObject("CDO.NewMail")
    
    Set objMessage.Configuration = objConfig
    
    
    	objCDOMail.To       = "jennifer@jlpgraffix.com"
    	objCDOMail.From     = "contactus@reimbconcepts.com"
    	objCDOMail.Subject  = "SMTP Relay Test"
    	objCDOMail.HTMLBody = "Contact: " & Request.Form("contact") & vbCrLf & "Company: " & Request.Form("company") & vbCrLf & "Email: " & Request.Form("email") &_
    	"Phone: " & Request.Form("phone") & vbCrLf & "BusinessType : " & Request.Form("businessType") & vbCrLf & "Comments: " & Request.Form("comments")
    	
    objCDOMail.Send
    
    
    Set Fields = Nothing
    Set objCDOMail = Nothing
    Set objConfig = Nothing
      
    Response.Redirect "mailSuccess.html"
    %>
    Thank you!
  • thesmithman
    New Member
    • Aug 2008
    • 37

    #2
    Hi Jennifer,
    Sounds like a parse error. I'm not a VBscript expert, but if you don't have an error log set up on your server, this is what I would do to find the problem:

    Make a copy of the script as it is and save it someplace on your computer.

    Edit the version on the server. Delete almost all the code. Don't try to send an e-mail yet; see if you can just output the POST data to the browser. If you're able to submit the form and get the "action" page to display your input text, then you are halfway there.

    After that you can re-introduce the rest of your code one line at a time until you get the 500 error again - and that will be the line with the problem!

    Again, sorry that's not as specific as you might have hoped but without a better background in VBScript that's the best I can offer.

    :)
    Last edited by thesmithman; May 17 '10, 10:23 PM. Reason: removed commentary

    Comment

    • jennifer6601
      New Member
      • May 2010
      • 3

      #3
      Thank you! I'll give that a try and let you know if it worked!

      Comment

      • jennifer6601
        New Member
        • May 2010
        • 3

        #4
        thesmithman,

        Thanks for the help. I got the form working. I all I did was change the server to "localhost" and that was it! Thanks again!

        Comment

        Working...