www.webdeveloper.com
Results 1 to 8 of 8

Thread: Email Address Post in ASP

  1. #1
    Join Date
    Feb 2003
    Posts
    50

    Email Address Post in ASP

    Just wondering if there is a way I can create a TEXT field within a form that would ask for an email address and when the user hits the SEND button it would put that email address with the addresses specified within my ASP script?

    I need to be done so that the user can first see who the request went to, but second, it owuld allow the user to reply to the addresses specified if something changed.

    Any help would be appreciated?

  2. #2
    Join Date
    Apr 2003
    Location
    London, UK
    Posts
    95
    Can you be more specific? What are you doing when you process the form results? Sending mail/storing data? And what addresses specified in your ASP script?

  3. #3
    Join Date
    Feb 2003
    Posts
    50
    Sorry...no problem...

    The input fields are posted to the body of the email and the specified addresses are those I've specified with...

    objMail.AddAddress "abc@def.com"

    What I need know is if the user inputs their email address in a text field on the form, is there a function/script within ASP that can say grab the data from this input field and put it into the TO: or "objMail.Address" function of my ASP script.

    So basically instead of having the input fields post to the body, can I have one particular input field post to the TO: portion of the email?

  4. #4
    Join Date
    Apr 2003
    Location
    London, UK
    Posts
    95
    Is this what you're after?

    extraEmail = request.form("NameOfEmailInput")

  5. #5
    Join Date
    Feb 2003
    Posts
    50
    Sorry Sheila, I a ASP newbie/moron, whatever you want to call me...what does that function do and where would I apply it in my ASP script? Here is the script I'm using:

    <%
    Option Explicit
    Response.Expires = 0

    ' Call dumpForm
    ' Response.End

    ' -- email object
    Dim objMail, theBody

    Set objMail=Server.CreateObject("Persits.MailSender")
    objMail.Host="pcaxs04"

    objMail.From="abc@def.com"
    objMail.Subject="Details"
    objMail.AddAddress "abc@def.com"

    objMail.isHTML = True
    objMail.Body=GenTheBody()
    objMail.Send
    Set objMail = Nothing
    Response.Redirect("index.htm")
    Response.End

    Sub dumpForm()
    Dim Item
    For Each Item in Request.Form %>
    Control name '<% = Item %>'
    = '<% = Request.Form(Item) %>'<BR>
    <% Next
    End Sub

    Function dumpFormToMsg()
    Dim Item, msg
    msg = ""
    For Each Item in Request.Form
    msg = msg & "'" & Item & "' = '" & Request.Form(Item) & "'" & vbCrLf
    Next
    dumpFormToMsg = msg
    End Function

    %>
    <html>
    <head><title>Details</title></head>
    <body>
    <%
    Function GenTheBody
    Dim msg
    msg = "<b><u>Details</b></u><br>" & vbCrLf & vbCrLf
    msg = msg & "Field One" & Request("ONE") & vbCrLf & "<br>"
    msg = msg & "Field Two" & Request("TWO") & vbCrLf & "<br>"
    GenTheBody = msg
    End Function
    %>
    </body>
    </html>

  6. #6
    Join Date
    Apr 2003
    Location
    London, UK
    Posts
    95
    I feel like the blind leading the blind here so if anyone else cares to step in and point out any glaring mistakes/omissions please do!

    Here goes. First you need to make sure that your email input has a name, eg.

    <input name="email" type="text" size="25" />


    Then you can reference it direct when you process the form data:


    ' Call dumpForm
    ' Response.End


    ' -- users email address Dim userEmail
    userEmail = request.form("email")



    And add it to your 'To' list using another AddAddress instruction:


    ' -- email object
    Dim objMail, theBody

    Set objMail=Server.CreateObject("Persits.MailSender")
    objMail.Host="pcaxs04"

    objMail.From="abc@def.com"
    objMail.Subject="Details"
    objMail.AddAddress "abc@def.com"
    objMail.AddAddress userEmail


    You might find this page useful:
    http://www.domaindlx.com/aspemail/manual.htm

  7. #7
    Join Date
    Feb 2003
    Posts
    50
    If you were here I'd kiss you Sheila, this works great and I love that its not complicated. LOL.

    I really appreciate your help.

  8. #8
    Join Date
    Apr 2003
    Location
    London, UK
    Posts
    95
    You're welcome!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles