Multiple field form for this ASP mailer script

Discussion in 'ASP General' started by Mark Creelman, Apr 3, 2004.

  1. Hello all:

    How do I convert this ASP mailer script to accept and mail multiple fields of a form. This will do one field only
    )iMesg.TextBody = Request.Form("body") and it works great.

    Seems pretty simple, but I am missing it.


    NOTE: Server uses "CDO" ONLY. (Not CDONTS)


    Thankyou for your response.

    Mark



    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    <html>
    <body>
    <!--metadata type="typelib" UUID="CD000000-8B95-11D1-82DB-00C04FB1625D" name="CDO for Windows 2000 Type Library" -->
    <%

    On Error Resume Next

    'Execute main code only if a message was submitted
    If Request.Form("send") <> "" Then


    Set iConf = CreateObject ("CDO.Configuration")
    Set Flds = iConf.Fields
    'Set and update fields properties
    Flds(cdoSendUsingMethod) = cdoSendUsingPort
    Flds(cdoSMTPServer) = "mail.yourserver.net"
    Flds.Update

    Set iMesg = CreateObject("CDO.Message")
    Set iMesg.Configuration = iConf

    'Format and send message
    Err.Clear

    iMesg.To = ""
    iMesg.From = Request.Form("from")
    iMesg.Subject = Request.Form("subject")
    iMesg.TextBody = Request.Form("body")
    iMesg.Send

    If Err.Number = 0 Then


    Result = "Message sent"

    Else

    Result = "Message not sent"

    End If

    End If
    %>

    <h1>CDO Test</h1>

    <p>
    <% Response.Write Result %>

    <form method=post>

    From: <input type=text name=from>

    <p>
    Subject: <input type=text name=subject>

    <p>
    Message: <br>
    <textarea name=body>Enter your message here.</textarea>

    <p>
    <input type=submit name=send value="Send">

    </form>

    </body>
    </html>
    --------------------------------------------------------------------------------------------------------
     
    Mark Creelman, Apr 3, 2004
    #1
    1. Advertising

  2. Mark Creelman

    Steven Burn Guest

    http://aspfaq.com/show.asp?id=2026

    --
    Regards

    Steven Burn
    Ur I.T. Mate Group
    www.it-mate.co.uk

    Keeping it FREE!

    Disclaimer:
    I know I'm probably wrong, I just like taking part ;o)


    Mark Creelman <> wrote in message
    news:...
    >
    >
    >
    > Hello all:
    >
    > How do I convert this ASP mailer script to accept and mail multiple fields

    of a form. This will do one field only
    > )iMesg.TextBody = Request.Form("body") and it works great.
    >
    > Seems pretty simple, but I am missing it.
    >
    >
    > NOTE: Server uses "CDO" ONLY. (Not CDONTS)
    >
    >
    > Thankyou for your response.
    >
    > Mark
    >
    >
    >
    > --------------------------------------------------------------------------

    ----------------------------------------------------------------------------
    ------------------------------------
    >
    > <html>
    > <body>
    > <!--metadata type="typelib" UUID="CD000000-8B95-11D1-82DB-00C04FB1625D"

    name="CDO for Windows 2000 Type Library" -->
    > <%
    >
    > On Error Resume Next
    >
    > 'Execute main code only if a message was submitted
    > If Request.Form("send") <> "" Then
    >
    >
    > Set iConf = CreateObject ("CDO.Configuration")
    > Set Flds = iConf.Fields
    > 'Set and update fields properties
    > Flds(cdoSendUsingMethod) = cdoSendUsingPort
    > Flds(cdoSMTPServer) = "mail.yourserver.net"
    > Flds.Update
    >
    > Set iMesg = CreateObject("CDO.Message")
    > Set iMesg.Configuration = iConf
    >
    > 'Format and send message
    > Err.Clear
    >
    > iMesg.To = ""
    > iMesg.From = Request.Form("from")
    > iMesg.Subject = Request.Form("subject")
    > iMesg.TextBody = Request.Form("body")
    > iMesg.Send
    >
    > If Err.Number = 0 Then
    >
    >
    > Result = "Message sent"
    >
    > Else
    >
    > Result = "Message not sent"
    >
    > End If
    >
    > End If
    > %>
    >
    > <h1>CDO Test</h1>
    >
    > <p>
    > <% Response.Write Result %>
    >
    > <form method=post>
    >
    > From: <input type=text name=from>
    >
    > <p>
    > Subject: <input type=text name=subject>
    >
    > <p>
    > Message: <br>
    > <textarea name=body>Enter your message here.</textarea>
    >
    > <p>
    > <input type=submit name=send value="Send">
    >
    > </form>
    >
    > </body>
    > </html>
    > --------------------------------------------------------------------------

    ------------------------------
    >
     
    Steven Burn, Apr 3, 2004
    #2
    1. Advertising

  3. Hi:

    Yes, that script does just what my first one does. I need to be able to
    modify it so that I can have multiple fields.

    Thanks,
    Mark

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Mark Creelman, Apr 3, 2004
    #3
  4. Mark Creelman

    Steven Burn Guest

    Just change;

    iMesg.TextBody = Request.Form("body")

    to;

    str1 = request.form("box1")
    str2 = request.form("box2")
    .....
    .....
    etc etc

    and;

    iMesg.TextBody = str1 & vbcrlf & str2 & vbcrlf & str3 & vbcrlf...... etc etc

    --
    Regards

    Steven Burn
    Ur I.T. Mate Group
    www.it-mate.co.uk

    Keeping it FREE!

    Disclaimer:
    I know I'm probably wrong, I just like taking part ;o)


    Mark Creelman <> wrote in message
    news:...
    >
    >
    > Hi:
    >
    > Yes, that script does just what my first one does. I need to be able to
    > modify it so that I can have multiple fields.
    >
    > Thanks,
    > Mark
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
     
    Steven Burn, Apr 3, 2004
    #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. =?Utf-8?B?Sm9l?=

    Mailer, Newsletter script in asp/asp.net

    =?Utf-8?B?Sm9l?=, Feb 22, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    908
    Juan T. Llibre
    Feb 23, 2005
  2. Andrzej Adam Filip
    Replies:
    0
    Views:
    4,095
    Andrzej Adam Filip
    Mar 31, 2008
  3. NotGiven
    Replies:
    3
    Views:
    353
    Michael D. Kersey
    May 13, 2004
  4. gwmbox
    Replies:
    0
    Views:
    125
    gwmbox
    Jul 9, 2003
  5. NotGiven
    Replies:
    3
    Views:
    306
    Michael D. Kersey
    May 13, 2004
Loading...

Share This Page