A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: php confirming sent mail to flash?

  1. #1
    will i ever get it?
    Join Date
    Feb 2004
    Posts
    707

    php confirming sent mail to flash?

    hi guys...i have a simple simple mail script that works fine. I am sending variables from Flash to php, but i would like a sort of call back from php to flash that says "ok Flash, tell the user it's all good"...then when Flash gets that, it does the desired effect. Ok, so i know the lv.sendAndLoad(url, lvGet,"GET") function, and i have another lv that is all ready to receive (lvGet.onLoad=function)...but what do i add to the php to talk back with flash??


    <?php
    $name=$_GET['name'];
    $email=$_GET['email'];
    $phone=$_GET['phone'];
    $note=$_GET['note'];

    $to="me@me.com";
    $subject="Visitor from Me.com";
    mail($to,$subject,$note);
    ?>

  2. #2
    Just Loitering
    Join Date
    Sep 2000
    Location
    England
    Posts
    215
    with a mail function you can usually do

    PHP Code:
    if (mail($to$subject$note)) {
        print 
    "mail sent";
    } else {
        print 
    "sending error";

    so if you can substitute those print lines to tell your flash the same info then that should work.

  3. #3
    will i ever get it?
    Join Date
    Feb 2004
    Posts
    707
    so, substitutue with something that the loadVars can read? Like echo("&reply=good&")??

  4. #4
    Registered User
    Join Date
    Feb 2001
    Posts
    13,041
    Hi,

    you have to use sendandload to retrieve the result, a separate load does not work

    On most servers mail returns nothing useful - success means that there was enough disk space to put the message in the outgoing queue, and failure would happen if the admin has blocked the mail function.

    Musicman

  5. #5
    Challenging Convention Andology's Avatar
    Join Date
    May 2001
    Location
    Cyprus
    Posts
    152
    the way i do it is to send vars to my php mailer form and set up timeout period:

    loadVariables(_rootirURL+"/scripts/enquiry_processor.php", this, "POST");
    TimeOutMax = 80;
    TimeOutLoop = 0;

    and then go to a loop on the timeline (frame label = "ServerCheck") with:

    if (result == "Okay") {
    gotoAndPlay("Success");
    } else if (result == "Fail") {
    gotoAndPlay("Error");
    }

    (then a couple of frames later)

    TimeOutLoop++;
    if (TimeOutLoop>TimeOutMax) {
    trace("Sending Form Data Has Timed Out");
    status = "Sorry "+_root:firstname+", The server seems to be taking longer than normal to confirm receipt of your details. Please check your internet connection and try submitting the form again. <br><br>If this problem continues and your internet connection appears to be fine, our servers may be experiencing a temporary difficulty.";
    gotoAndPlay("Error");
    } else {
    gotoAndPlay("ServerCheck");
    }

    and then last line on the php script (enquiry_processor.php):

    // Confirm Success Back To Flash
    $output = "&result=Okay";
    echo $output ;

    Job done...

    Hope that helps...

    Cheers

    Andy
    The Andology Corporation Ltd
    Challenging Convention
    Fusion of Business & Technology

    Joop Media - The Final Link In The Chain

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