Why isn't this working?

Discussion in 'ASP.NET / ASP.NET Core' started by wisemx, Jan 23, 2007.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Bruce

    Bruce DiscountASP.NET Staff

  2. I am a noob that wanted to use an email form on my webpage, so i got a already made script from the internet.
    But it's not working on discountasp.net, i tried on other server and worked well.
    Can you guys help me^?

    The code is this :



    <%@language="VBScript"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <title>Simple ASP E-mail Form</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    </head>
    <!-- Beginning of ASP Form-Handler Script -->
    <%
    'Check for required fields

    If (Request.form("user_email") <> "" and Request.form("user_subject") <> "" and Request.form("question") <> "") then
    'Declare variables for the form input fields and the e-mail
    dim strAddr, replyTo, strSubject, strName
    dim strMsg, strDeptPhone, strPerspective
    dim strClassAssignment, strTermPaper
    dim strText

    'Get input from the form and assign it to script variables
    strAddr = Trim(Request.form("user_email"))
    if strAddr <> "" then
    replyTo = cstr(strAddr)
    end if

    strSubject = Request.form("user_subject")
    strName = Request.form("user_name")
    strMsg = Request.form("question")
    strDeptPhone = Request.form("dept_phone")
    strPerspective = Request.form("perspective")
    strClassAssignment = Request.form("class_assignment")
    strTermPaper = Request.form("term_paper")
    strText = "E-mail from: " &amp; strName &amp; vbCrLf &amp;_
    "Concerning: " &amp; strMsg &amp; vbCrLf &amp; vbCrLf &amp;_
    "Dept. Phone: " &amp; strDeptPhone &amp; vbCrLf &amp;_
    "Perspective: " &amp; strPerspective &amp; vbCrLf &amp;_
    "Class Assignment: " &amp; strClassAssignment &amp; vbCrLf &amp; "Term Paper: " &amp; strTermPaper &amp; vbCrLf &amp; "."
    'Note: use vbCrLf (as above) to add line breaks in the e-mail message
    send_email()
    else
    'We are here because user has not filled out required fields
    'Send user back to form
    response.redirect("emailform2.html")
    end if
    'The send_email function formats and sends the e-mail
    function send_email()
    'Create an object or container for your mail
    Dim objMail
    Set objMail = Server.CreateObject("CDO.Message")
    strSubject = strSubject
    'Format the e-mail using fields from your HTML form
    objMail.To = "[email protected]"
    objMail.From = "[email protected]" 'Generic address is a cue about origin
    objMail.ReplyTo = replyTo

    objMail.Subject = strSubject
    objMail.TextBody = strText
    objMail.Send
    Set objMail= Nothing
    if err.number > 0 then
    response.write "Errors were encountered in sending your e-mail message. "&amp;_
    "Please try again, or contact the <a href='mailto:[email protected]'>webmaster</a>"
    else
    'reformat strMsg to preserve line breaks in the question textarea
    strMsg = replace(strMsg,vbcrlf,"")
    response.write "<h3>Thank you for using our e-mail form!</h3>" &amp;_
    "Your information was submitted as follows:" &amp;_
    "Name: " &amp; strName &amp; "" &amp;_
    "E-mail Address: " &amp; strAddr &amp; "" &amp;_
    "Dept. Phone: " &amp; strDeptPhone &amp; "" &amp;_
    "Perspective: " &amp; strPerspective &amp; "" &amp;_
    "Class Assignment: " &amp; strClassAssignment &amp; "" &amp;_
    "Term Paper: " &amp; strTermPaper &amp; "" &amp;_
    "Question: " &amp; strMsg &amp; "" &amp;_
    "<a href='emailform2.html'>Return to the e-mail form</a>"
    end if
    end function
    %>
    <!-- end of form handler script -->
    <p>Updated 4 April 2006
    Comments to <a href="mailto:[email protected]">webmaster</a></p>
    <p>&amp;nbsp;</p>
    </body>
    </html></BLOCKQUOTE>
    [/quote]
     
  3. That a very bad code that was written by the author, they should test the code first be publishing on the website, some codes do work and most of them are very non fuctional,


    perhaps on a website, you should ask the administrator why is that code not working, or it could be a lack of coding expernice the Administrator has written out, I seen most websites with codes like that it can be really annoying, make sure the database is written and read and write - able.


    I use ASP for my website, but I never use PHP or cgi, because they are not very secure.[​IMG]





    Website Address: http://www.houston777network.net


    Feel free to have a look, its worth an expernice.

    Sir. William Houston
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page