How do i run this page

Discussion in 'C#' started by dm123, Mar 5, 2008.

  1. #1
    The following code, is for inputing info to a e-mail address
    how do i run this asp page in same file?

    <%

    If “” & request(“send”) = “true” then



    set msg = Server.CreateObject("CDONTS.NewMail")

    msg.BodyFormat = 0'mail_format

    msg.MailFormat = 0'mail_format

    msg.Subject = request(“subject”)

    msg.Body = request(“msg”)

    msg.From = "info@dm.com"

    msg.To = “dm@hotmail.com”

    msg.Send()



    end if

    %>



    <form action=“thispage.asp?send=true” method=post>



    <input type=text name=”subject”>



    <textarea rows=5 cols=50 name=msg></textarea>



    <input type=submit>



    </form>
     
    dm123, Mar 5, 2008 IP
  2. vpguy

    vpguy Guest

    Messages:
    275
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If you put all that into one file it should probably work. The only problem I can see that would prevent it from working is this line:

    If “” & request(“send”) = “true” then
    Code (markup):
    It should probably read:

    If request(“send”) = “true” then
    Code (markup):

    Also, the quotes you are using are not code-friendly. They should be replaced with "straight quotes like this" instead.
     
    vpguy, Mar 8, 2008 IP
  3. dylanj

    dylanj Peon

    Messages:
    173
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    0
    #3
    Try this:
    
    <%
    If Request.Form("msg") <> "" then
      set msg = CreateObject("CDO.Message")
      msg.From = "info@dm.com"
      msg.To = "dm@hotmail.com"
      msg.Subject = request.form("subject")
      msg.TextBody = request.form("msg")
      msg.Send
      set msg = nothing
      response.write("<p>message sent!</p>")
    end if
    %>
    <form name="frmsend" action="<%=Request.ServerVariables("URL")%>" method="post">
    <input type="text" name="subject"><br />
    <textarea rows="5" cols="50" name="msg"></textarea><br />
    <input type="submit" value="Send Message">
    </form>
    
    Code (markup):
    Put that in a .ASP file, and it'll all work automatically. It doesn't matter what the ASP file is called.
     
    dylanj, Mar 14, 2008 IP
  4. jawahar

    jawahar Active Member

    Messages:
    1,044
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    95
    #4
    jawahar, Mar 15, 2008 IP