3 Replies Latest reply on Jan 15, 2010 7:15 AM by kglad

    Sending Email?

    kylesmark Level 1

      I was useing the gotoandlearn.com website and had a problem all my mail is failed i do not think im accessing my php file at all.

       

      stop();

      var senderLoad:LoadVars = new LoadVars();
      var receiveLoad:LoadVars = new LoadVars();

      sender.onRelease = function() {
      senderLoad.theName = theName.text;
      senderLoad.theEmail = theEmail.text;
      senderLoad.theMessage = theMessage.text;
      senderLoad.sendAndLoad("http://www.myWebsite.com/send.php",receiveLoad);
      }

      receiveLoad.onLoad = function() {
      if(this.sentOk) {
        _root.gotoAndStop("success");
      }
      else {
        _root.gotoAndStop("failed");
      }
      }

       

      my php file send.php:


      <?php

       

      $to

       

      = "emailer@myWebstie.com";

      $subject

       

      = "Flash Contact Form Submission";

      $message

       

      = "Name:" . $theName;

      $message

       

      .= "\nEmail: " . $theEmail;

      $message

       

      .= "\n\nMessage: " . $theMessage;

      $headers

       

      = "From: $theEmail";

      $headers

       

      .= "\nReply-To: $theEmail";

       

      $sentOk

       

      = mail($to,$subject,$message,$headers);

       

      echo

       

      "sentOk=" . $sentOk;

       

      ?>

        • 1. Re: Sending Email?
          kglad Adobe Community Professional & MVP

          use a local path, "POST" your variables in flash and parse those variables in php:

           


           

          stop();

          var senderLoad:LoadVars = new LoadVars();
          var receiveLoad:LoadVars = new LoadVars();

          sender.onRelease = function() {
          senderLoad.theName = theName.text;
          senderLoad.theEmail = theEmail.text;
          senderLoad.theMessage = theMessage.text;
          senderLoad.sendAndLoad("http://www.myWebsite.com/send.php",receiveLoad,"POST");
          }

          receiveLoad.onLoad = function() {
          if(this.sentOk) {
            _root.gotoAndStop("success");
          }
          else {
            _root.gotoAndStop("failed");
          }
          }

           

          my php file send.php:


          <?php

           

          $to

           

          = "emailer@myWebstie.com";

          $subject

           

          = "Flash Contact Form Submission";

          $message

           

          = "Name:" .$_POST[ "theName"];

          $message

           

          .= "\nEmail: " . $_POST["theEmail"];

          $message

           

          .= "\n\nMessage: " . $_POST["theMessage"];

          $headers

           

          = "From:$_POST["theEmail"];

          ";

          $headers

           

          .= "\nReply-To: $_POST["theEmail"];

          ";

           

          $sentOk

           

          = mail($to,$subject,$message,$headers);

           

          echo

           

          "sentOk=" . $sentOk;

           

          ?>

          • 2. Re: Sending Email?
            kylesmark Level 1

            i changed to post but still get same error, the swf file and the php are in the same directory in my websites folders can i just put "send.php" like it is? but either way it dont work...

             

             

             

            <?php

             

            $to

             

            = "emailer@myWebsite.com";

            $subject

             

            = "Flash Contact Form Submission";

            $message

             

            = "Name:" .$_POST["theName"];

            $message

             

            .= "\nEmail: " .$_POST["theEmail"];

            $message

             

            .= "\n\nMessage: " .$_POST["theMessage"];

            //$headers = "From:$_POST["theEmail"]; ";

            //$headers .= "\nReply-To:$_POST["$theEmail"]; ";

             

            $sentOk

             

            = mail($to,$subject,$message);

             

            echo

             

            "sentOk=" . $sentOk;

             

            ?>

             

            stop();

            var senderLoad:LoadVars = new LoadVars();
            var receiveLoad:LoadVars = new LoadVars();

            sender.onRelease = function() {
            senderLoad.theName = theName.text;
            senderLoad.theEmail = theEmail.text;
            senderLoad.theMessage = theMessage.text;
            senderLoad.sendAndLoad("send.php",receiveLoad,"POST");
            }

            receiveLoad.onLoad = function() {
            if(this.sentOk) {
              _root.gotoAndStop("success");
            }
            else {
              _root.gotoAndStop("failed");
            }
            }

            • 3. Re: Sending Email?
              kglad Adobe Community Professional & MVP

              copy and paste the error message.