A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: ASP form mailer.......

Hybrid View

  1. #1
    Senior Member
    Join Date
    Apr 2000
    Posts
    168

    ASP form mailer.......

    I am clueless as far as ASP goes, so be nice... =)
    In an MC on my _root, I have a simple form with three dynamic text fields with these variable names attached: "email" "name" "subject".
    I then have a hidden dynamic text field called "toemail", I have done this so I can use the MC a bunch of times and just change that hidden field so I can send it to a different email address, all the while using the same ASP script.. IS THAT CORRECT??
    IF SO, how do I call that variable into the ASP script so it will email the info to that address!????(I got this script from a tutorial here on Flashkit and I know there is some stuff towards the bottom that needs to be changed to match the changes I made at the top--I just don't know what or how)

    Here is what I have so far...<%

    Name = Request.form("Name")

    Email = Request.form("Email")

    Subject = Request.form("Subject")

    ////////Comment: I haven't changed anything below this line///////////////

    strName = "Your Name"

    strEmail = "YourEmail@YourSite.com"



    strSubject = "Tutorial Request Example Email"

    strBody = ToComments & HearAbout & Company



    Set Mailer = Server.CreateObject("SMTPsvg.Mailer")

    Mailer.RemoteHost = "mail.innerhost.com"

    Mailer.FromName = FirstName

    Mailer.FromAddress = Email

    Mailer.AddRecipient strName, strEmail

    Mailer.Subject = (strSubject)

    Mailer.BodyText = strBody



    if Mailer.SendMail then

    Response.Write "_root.Mail.EmailStatus=Complete - Your mail has been sent"

    else

    Response.Write "_root.Mail.EmailStatus=Failure - Your mail was not sent - errors"

    Response.Write Mailer.Response

    end if

    %>
    These are buttons for vinyl, trust me...

  2. #2
    Member
    Join Date
    Aug 2001
    Location
    Hawaii
    Posts
    64
    This should help you out and give you a better understanding of how to create a form in flash using ASP.

    Try this.

    Make a new movie.

    Layer 1, Frame 1
    Make three Input text fields.
    Label them:
    1. name
    2. email
    3. content

    Layer 2, Frame 1
    Make two buttons.
    Submit and Clear. These buttons do pretty much what they say.
    The submit button sends the request to the ASP script and the clear button clears the input fields if the user wants to start over or makes mistake on the form exc....

    SUBMIT (Place the actions below on the SUBMIT button)

    ------------------------------------------------------
    on (release) {
    if (name ne "" and email ne "" ) {
    loadVariablesNum("email.asp", 0, "POST");
    gotoAndPlay("valid");
    } else {
    gotoAndPlay("invalid");
    }
    }


    CLEAR (Place the actions below on the CLEAR button)

    ------------------------------------------------------
    on (release) {
    name = "";
    email = "";
    content = "";
    }
    ------------------------------------------------------


    On the SUBMIT button you will notice the use of this code:

    if (name ne "" and email ne "" )

    and

    gotoAndPlay("valid");
    } else {
    gotoAndPlay("invalid");
    }
    }

    The use of the above code is so that the user has to fill out the Name and Email field of the form or it will not submit. This is optional of coarse. For the purposes of this example we will use it. So that means you will need to make some Frame Labels.

    Layer 3, Frame 2
    Label the frame valid
    Also include some text on this frame letting the user know there message has been sent. You also might want to place a button taking the user back to the form just in case they want to send another massage. If you do choose to place a button sending the user back to the form make sure to place this action script on the "back" button.

    ------------------------------------------------------
    on (release) {
    name = "";
    email = "";
    content = "";
    gotoAndStop(1);
    }
    ------------------------------------------------------

    If you do not place the when the user returns to the form to place a second message the form fields will be already filled out with the previous message.


    Layer 3, Frame 3
    Label the frame invalid
    Place some text on this frame alerting the user that all of the required fields have not been filled out and they must fill out the required fields. You will also want to place a button taking the user back to the form so they can complete it.

    Layer 4, Frame 1, 2 and 3
    Do not forget to place your stop actions.
    On layer 4 put a stop action on frames 1, 2 and 3.



    Now for the ASP page

    email.asp

    ------------------------------------------------------------
    <%@ LANGUAGE="VBSCRIPT" %>
    <%
    Sub Write(strWriteThis)
    response.write(strWriteThis & "<br>")
    end sub

    %>
    <%
    strFrom=request.form("email")
    strTo="you@your_email.com"
    strSubject = "This the subject that will appear in the sent email"
    strBody="Name: " & request.form("name") & CHR(13) & "Email: " & request.form("email") & CHR(13) & "Content: " & request.form("content")

    Set myCDONTSMail = CreateObject("CDONTS.NewMail")

    myCDONTSMail.Send strFrom,strTo,strSubject,strBody,strContent

    Set myCDONTSMail = Nothing
    %>
    ------------------------------------------------------------


    This person receiving the email will have the subject line you defined in the ASP page and the body of the email will be look like this.

    Name: Schimke
    Email: whatever@whatever.com
    Content: This is a test

    Test the form here:
    TEST FORM HERE

    Now there are many ways and combinations to making a form. This is my basic approach. In the future you may want to consider form field validation among other variables. Form field validation which will check to see if your user has placed a valid email address.

    Hope this helps.

    light4u
    Last edited by light4u; 04-18-2003 at 04:28 AM.
    Design & Marketing
    http://www.dreamteammedia.com

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center