Send form data using CDO

Discussion in 'ASP General' started by Kenny, Nov 7, 2005.

  1. Kenny

    Kenny Guest

    I'm trying to retrieve the data off a form (survey.htm) and email the results
    back to me using CDO and ASP (survey.asp). I'm confused as to how to
    retrieve the form data from survey.htm and send it using survey.asp. Below is
    a sample ASP script that I found on ASPFAQ.com and it works fine, but now how
    do I grab the info from a form and incorporate it into the emal. Thanks.
    Appreciate any help or guidance.

    Kenny

    <%
    sch = "http://schemas.microsoft.com/cdo/configuration/"

    Set cdoConfig = CreateObject("CDO.Configuration")

    With cdoConfig.Fields
    .Item(sch & "sendusing") = 2 ' cdoSendUsingPort
    .Item(sch & "smtpserver") = "servername"
    .update
    End With

    Set cdoMessage = CreateObject("CDO.Message")

    With cdoMessage
    Set .Configuration = cdoConfig
    .From = ""
    .To = ""
    .Subject = "Sample CDO Message"
    .TextBody = "This is a test for CDO.message"
    .Send
    End With

    Set cdoMessage = Nothing
    Set cdoConfig = Nothing
    %>
     
    Kenny, Nov 7, 2005
    #1
    1. Advertising

  2. Kenny

    Drew Guest

    Depending on how you want to do it, if you want it to look nice, just make
    your .TextBody something like this

    ..TextBody = "Name: " & Request.Form("Name") & "<br>Address: " &
    Request.Form("Address")" 'and so on and so on

    If you want it just thrown in there all messy looking just do this,

    ..TextBody = "Form Data is <br>" & Request.Form()

    If your form method is set to GET, change Request.Form to
    Request.Querystring.

    HTH,
    Drew



    "Kenny" <> wrote in message
    news:...
    > I'm trying to retrieve the data off a form (survey.htm) and email the
    > results
    > back to me using CDO and ASP (survey.asp). I'm confused as to how to
    > retrieve the form data from survey.htm and send it using survey.asp. Below
    > is
    > a sample ASP script that I found on ASPFAQ.com and it works fine, but now
    > how
    > do I grab the info from a form and incorporate it into the emal. Thanks.
    > Appreciate any help or guidance.
    >
    > Kenny
    >
    > <%
    > sch = "http://schemas.microsoft.com/cdo/configuration/"
    >
    > Set cdoConfig = CreateObject("CDO.Configuration")
    >
    > With cdoConfig.Fields
    > .Item(sch & "sendusing") = 2 ' cdoSendUsingPort
    > .Item(sch & "smtpserver") = "servername"
    > .update
    > End With
    >
    > Set cdoMessage = CreateObject("CDO.Message")
    >
    > With cdoMessage
    > Set .Configuration = cdoConfig
    > .From = ""
    > .To = ""
    > .Subject = "Sample CDO Message"
    > .TextBody = "This is a test for CDO.message"
    > .Send
    > End With
    >
    > Set cdoMessage = Nothing
    > Set cdoConfig = Nothing
    > %>
    >
     
    Drew, Nov 7, 2005
    #2
    1. Advertising

  3. Kenny

    Kenny Guest

    Thanks, I really appreciate your help. I was able to use "& request.form() &"
    to get the information but just like you said, it looked all mumble jumbled
    together. I tried inserting html coding; however, using it in TextBody = " "
    only repeats the html coding in the message, so when I type <br>, that's what
    appears in the email generated the code <br> instead of the line break. How
    do I import the form and use html?

    Kenny

    "Drew" wrote:

    > Depending on how you want to do it, if you want it to look nice, just make
    > your .TextBody something like this
    >
    > ..TextBody = "Name: " & Request.Form("Name") & "<br>Address: " &
    > Request.Form("Address")" 'and so on and so on
    >
    > If you want it just thrown in there all messy looking just do this,
    >
    > ..TextBody = "Form Data is <br>" & Request.Form()
    >
    > If your form method is set to GET, change Request.Form to
    > Request.Querystring.
    >
    > HTH,
    > Drew
    >
    >
    >
    > "Kenny" <> wrote in message
    > news:...
    > > I'm trying to retrieve the data off a form (survey.htm) and email the
    > > results
    > > back to me using CDO and ASP (survey.asp). I'm confused as to how to
    > > retrieve the form data from survey.htm and send it using survey.asp. Below
    > > is
    > > a sample ASP script that I found on ASPFAQ.com and it works fine, but now
    > > how
    > > do I grab the info from a form and incorporate it into the emal. Thanks.
    > > Appreciate any help or guidance.
    > >
    > > Kenny
    > >
    > > <%
    > > sch = "http://schemas.microsoft.com/cdo/configuration/"
    > >
    > > Set cdoConfig = CreateObject("CDO.Configuration")
    > >
    > > With cdoConfig.Fields
    > > .Item(sch & "sendusing") = 2 ' cdoSendUsingPort
    > > .Item(sch & "smtpserver") = "servername"
    > > .update
    > > End With
    > >
    > > Set cdoMessage = CreateObject("CDO.Message")
    > >
    > > With cdoMessage
    > > Set .Configuration = cdoConfig
    > > .From = ""
    > > .To = ""
    > > .Subject = "Sample CDO Message"
    > > .TextBody = "This is a test for CDO.message"
    > > .Send
    > > End With
    > >
    > > Set cdoMessage = Nothing
    > > Set cdoConfig = Nothing
    > > %>
    > >

    >
    >
    >
     
    Kenny, Nov 13, 2005
    #3
  4. Kenny

    PJones Guest

    http://www.powerasp.com/content/new/sending_email_cdosys.asp

    http://www.powerasp.com/content/new/self_submitting_contact_form_using_cdosys.asp



    "Kenny" <> wrote in message
    news:...
    > Thanks, I really appreciate your help. I was able to use "& request.form()
    > &"
    > to get the information but just like you said, it looked all mumble
    > jumbled
    > together. I tried inserting html coding; however, using it in TextBody =
    > " "
    > only repeats the html coding in the message, so when I type <br>, that's
    > what
    > appears in the email generated the code <br> instead of the line break.
    > How
    > do I import the form and use html?
    >
    > Kenny
    >
    > "Drew" wrote:
    >
    >> Depending on how you want to do it, if you want it to look nice, just
    >> make
    >> your .TextBody something like this
    >>
    >> ..TextBody = "Name: " & Request.Form("Name") & "<br>Address: " &
    >> Request.Form("Address")" 'and so on and so on
    >>
    >> If you want it just thrown in there all messy looking just do this,
    >>
    >> ..TextBody = "Form Data is <br>" & Request.Form()
    >>
    >> If your form method is set to GET, change Request.Form to
    >> Request.Querystring.
    >>
    >> HTH,
    >> Drew
    >>
    >>
    >>
    >> "Kenny" <> wrote in message
    >> news:...
    >> > I'm trying to retrieve the data off a form (survey.htm) and email the
    >> > results
    >> > back to me using CDO and ASP (survey.asp). I'm confused as to how to
    >> > retrieve the form data from survey.htm and send it using survey.asp.
    >> > Below
    >> > is
    >> > a sample ASP script that I found on ASPFAQ.com and it works fine, but
    >> > now
    >> > how
    >> > do I grab the info from a form and incorporate it into the emal.
    >> > Thanks.
    >> > Appreciate any help or guidance.
    >> >
    >> > Kenny
    >> >
    >> > <%
    >> > sch = "http://schemas.microsoft.com/cdo/configuration/"
    >> >
    >> > Set cdoConfig = CreateObject("CDO.Configuration")
    >> >
    >> > With cdoConfig.Fields
    >> > .Item(sch & "sendusing") = 2 ' cdoSendUsingPort
    >> > .Item(sch & "smtpserver") = "servername"
    >> > .update
    >> > End With
    >> >
    >> > Set cdoMessage = CreateObject("CDO.Message")
    >> >
    >> > With cdoMessage
    >> > Set .Configuration = cdoConfig
    >> > .From = ""
    >> > .To = ""
    >> > .Subject = "Sample CDO Message"
    >> > .TextBody = "This is a test for CDO.message"
    >> > .Send
    >> > End With
    >> >
    >> > Set cdoMessage = Nothing
    >> > Set cdoConfig = Nothing
    >> > %>
    >> >

    >>
    >>
    >>
     
    PJones, Nov 27, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Guest
    Replies:
    2
    Views:
    962
    dave wanta
    Jul 11, 2003
  2. Lance Safford
    Replies:
    0
    Views:
    421
    Lance Safford
    Apr 21, 2004
  3. Tim M
    Replies:
    0
    Views:
    165
    Tim M
    Dec 1, 2005
  4. Replies:
    0
    Views:
    320
  5. joeyjoejnr

    send cdo e-mail with database data

    joeyjoejnr, Aug 6, 2007, in forum: ASP General
    Replies:
    2
    Views:
    273
    joeyjoejnr
    Aug 16, 2007
Loading...

Share This Page