1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Internal server error?

Discussion in 'C#' started by davidcarlson, Aug 10, 2008.

  1. #1
    I am trying to set up an asp page to email the information from an online form.
    The code I am using is below.
    When I don't use the second block of code (the part actually sending the mail), the variables come through fine and the response is written to the screen.
    When I use all of the code, the submit button on the html page leads you to a page that says this:
    Server Error
    500 - Internal server error.
    There is a problem with the resource you are looking for, and it cannot be displayed.
    If anyone can figure out what is wrong with the code I would appreciate it.

    <html>
    <body>
    <%

    Dim firstname, lastname, email, message, tenant, address, aptnum, NewMailObj
    firstname=request.Querystring("firstname")
    lastname=request.Querystring("lastname")
    email=request.Querystring("email")
    message=request.Querystring("message")
    tenant=request.Querystring("tenant")
    address=request.Querystring("address")
    aptnum=request.Querystring("aptnum")


    Set NewMailObj=Server.CreateObject("CDO.Message")
    NewMailObj.From = "dave@timberridgeproperties.com"
    NewMailObj.To = "dave@timberridgeproperties.com"
    NewMailObj.Subject = "Online Contact Form"
    NewMailObj.HTMLBody = "Name:" & firstname & " " & lastname & "<br>Email:" & email & "<br>Message:" & message & "<br>tenant?" & tenant & "<br> address:" & address & " apt #" & aptnum
    NewmailObj.Send


    Set NewMailObj = nothing
    Response.write("Thank you for your submission.")
    %>
    </body>
    </html>
     
    davidcarlson, Aug 10, 2008 IP
  2. 50plus

    50plus Guest

    Messages:
    234
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    It is likely that another email component is installed on the server [Server.CreateObject("CDO.Message")], you might want to ask your host about that.
     
    50plus, Aug 11, 2008 IP
  3. davidcarlson

    davidcarlson Guest

    Messages:
    40
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Ok I checked Godaddy's website;
    It says I need to change my IIS SMTP port to 8025.
    If I'm not mistaken that's something I need to do on my computer? Why do I have to set up an email server on my computer so a website hosted through godaddy can send mail?
     
    davidcarlson, Aug 11, 2008 IP
  4. vihutuo

    vihutuo Well-Known Member

    Messages:
    1,511
    Likes Received:
    34
    Best Answers:
    0
    Trophy Points:
    180
    #4
    Try this

    Set cdoConfig = CreateObject("CDO.Configuration")

    With cdoConfig.Fields
    .Item(cdoSendUsingMethod) = 8025
    .Item(cdoSMTPServer) = "<enter_mail.server_here>"
    .Update
    End With

    Set NewMailObj.Configuration = cdoConfig
     
    vihutuo, Aug 11, 2008 IP
  5. davidcarlson

    davidcarlson Guest

    Messages:
    40
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Ok but what do I enter in the <enter_mail.server_here> ?
    sorry I'm new to asp (actually had never heard of it until about a week ago).
     
    davidcarlson, Aug 11, 2008 IP
  6. jdkjdk

    jdkjdk Peon

    Messages:
    21
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Hi, you dont have to change anything on your computer :)

    If you want to use the example you were given you need to replace <enter_mail.server_here> with the mail server address. for me it is mail.mydomain.com.au... mydomain.com.au is the name of my website.Yours might be mail.timberridgeproperties.com
     
    jdkjdk, Aug 11, 2008 IP
  7. jdkjdk

    jdkjdk Peon

    Messages:
    21
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Also, it will REALLY help you to turn off Friendly Error Messages. If you're in IE - some instructions:

    http://www. webwizguide.com/kb/asp_knowledgebase/friendly_HTTP_error_messages.asp

    First you need to select 'Tools' from the menu at the top of Internet Explorer.

    Then from the drop down menu choose 'Internet Options'.
    IE's Tolls drop down menu
    Once the 'Internet Options' Dialog box opens you want to choose the 'Advanced' tab.

    You will then see a list of Advanced functions of Internet Explorer that can be turned on or off by checking the tick boxes.

    Look down the list for 'Show friendly HTTP error messages' and uncheck the tick box for it followed by the 'Apply' button at the bottom of the dialog box.
    IE's Advanced menu options
     
    jdkjdk, Aug 11, 2008 IP
  8. davidcarlson

    davidcarlson Guest

    Messages:
    40
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    ok that makes sense; it's actually email.timberridgeproperties.com, but it's still not working. I copied the following from godaddy's help center:

    ************************************************

    To send an email with Active Server Pages requires a component such as CDO.MESSAGE, which is supported on our Windows shared hosting servers.

    In order to use MailEnable and CDOSYS at the same time you will need to change the Internet Information Services (IIS) SMTP port to port 8025 using the General tab in the SMTP virtual server properties dialog box. For more information on how to do this see Microsoft Windows Server Tech Center.

    Next, you will need to add additional lines of code to the Code Snippet for CDO Messages.
    -----------------
    Set objMail = Server.CreateObject("CDO.Message")
    objMail.From = "YOUR FROM EMAIL ADDRESS"
    objMail.To = "YOUR TO EMAIL ADDRESS"
    objMail.Subject = "YOUR EMAIL SUBJECT LINE"
    objMail.TextBody = "YOUR MESSAGE BODY"
    objMail.Send

    Set objMail = Nothing
    ---------------------------------

    Now, modify the Code Snippet for CDO Messages as follows.
    ----------------------------------------------
    sch = "http://schemas.microsoft.com/cdo/configuration/"
    Set cdoConfig = Server.CreateObject("CDO.Configuration")
    With cdoConfig.Fields
    .Item(sch & "sendusing") = 2 ' cdoSendUsingPort
    .Item(sch & "smtpserver") = "127.0.0.1" (add your smtp server address here)
    .update
    End With

    Set objMail = Server.CreateObject("CDO.Message")
    Set objMail.Configuration = cdoConfig
    objMail.From = "YOUR FROM EMAIL ADDRESS"
    objMail.To = "YOUR TO EMAIL ADDRESS"
    objMail.Subject = "YOUR EMAIL SUBJECT LINE"
    objMail.TextBody = "YOUR MESSAGE BODY"
    objMail.Send

    Set objMail = Nothing
    Set cdoConfig = Nothing
    *********************************
    It seems like godaddy is trying to tell me to change something in my computer's settings. I followed the link to the windows server tech center and it had a lot of instructions involving setting up a virtual server via my computer's Control Panel. Makes no sense to me.
     
    davidcarlson, Aug 11, 2008 IP
  9. jdkjdk

    jdkjdk Peon

    Messages:
    21
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    No, you don't need to install anything on your computer. Your web server and mail server have the software and configuration on them.

    The code you've posted evokes an application (for a simple explanation) on the web hosts computer that sends an email to your webserver and then on to the recipient. Also, the instructions are for someone who runs their own server. It sounds like you've looked too hard.

    Can you still not send messages? What error message are you getting?

    What do you get with this code:

    Set cdoConfig = CreateObject("CDO.Configuration")

    With cdoConfig.Fields
    .Item(cdoSendUsingMethod) = cdoSendUsingPort
    .Item(cdoSMTPServer) = "email.timberridgeproperties.com"
    .Item(cdoSMTPAuthenticate) = 1
    .Item(cdoSendUsername) = "YOURUSERNAME"
    .Item(cdoSendPassword) = "YOURPASSWORD"
    .Update
    End With


    Set cdoMessage = CreateObject("CDO.Message")

    With cdoMessage
    Set .Configuration = cdoConfig
    End With


    cdoMessage.From = "dave@timberridgeproperties.com"
    cdoMessage.To = "dave@timberridgeproperties.com"
    cdoMessage.Subject = "Mail test"
    cdoMessage.TextBody = "Text body"

    cdoMessage.Send
    Set cdoMessage = Nothing
     
    jdkjdk, Aug 12, 2008 IP
  10. davidcarlson

    davidcarlson Guest

    Messages:
    40
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    I have been getting the same message all along,
    When you hit "Submit" it leads you to an html page (you can even look at the html code if you click on "view page source").
    The page says : 500 - Internal Server Error
    There is a problem with the page you are looking for, and it cannot be displayed.
    The url shows my asp page with the variables included, but it always shows this error page ^ in the window.

    I also tried eliminating the block of code that actually sends the mail, leaving in the block that does the configuration. Same problem.
    I'm assuming that my username and password are the same I would use to log into my email.
     
    davidcarlson, Aug 12, 2008 IP
  11. jdkjdk

    jdkjdk Peon

    Messages:
    21
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    Can you please turn off friendly error messages and you'll find out the real error. This will make your life so much easier - it'll actually tell you what line has the error on it.

    Did you try my code by itself? Set up a new page and just put my info in :)

    Also, are you saying an html page.. because you need to lead to an asp page :)
     
    jdkjdk, Aug 12, 2008 IP
  12. davidcarlson

    davidcarlson Guest

    Messages:
    40
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #12
    I have friendly error messages turned off.
    When I said it leads you to an html page, I meant it leads you to what appears to be a web page.
    My 'Submit' button is set up to lead to my asp page with the code to send the mail. When I don't have the code to send the mail included in my asp page, it has no problem extracting the variables from the form and printing a 'thank you for your submission' message to the screen.
    As soon as I try including the code to send the mail, or just the code to set up the configuration(including the example you gave me), it leads to a web page that has the error message on it. If you click on "view page source", it shows code for the html page that is in the window(the error page). I think it might be a default page from godaddy.(?)
    Is it possible that I need to set up something with my godaddy hosting account to get asp to work? I know a lot of people have trouble with this kind of thing on their godaddy pages.
    Thanks for your help so far.
     
    davidcarlson, Aug 12, 2008 IP
  13. davidcarlson

    davidcarlson Guest

    Messages:
    40
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #13
    by the way the error message looks exactly the same whether I try with firefox, IE, or safari.
     
    davidcarlson, Aug 12, 2008 IP
  14. jdkjdk

    jdkjdk Peon

    Messages:
    21
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #14
    You do have windows hosting on Godaddy don't you? :) ASP will be set up on that :)

    Feel free to PM with your code and email addy and I'll check it out for you :)
     
    jdkjdk, Aug 12, 2008 IP
  15. davidcarlson

    davidcarlson Guest

    Messages:
    40
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #15
    Well thanks for your help but I think I need to understand asp better before I continue with this.
     
    davidcarlson, Aug 13, 2008 IP