32 Replies Latest reply on Jan 11, 2010 3:37 PM by kglad

    HELP Contact Page

    PrintingByDBE Level 1

      on my website the5150crew.com

      when you go to the contact page and send me a msg it opens your (default) mail

      how can i just send a message to me with out having to type the message then it opens my mail then click enter???

        • 1. Re: HELP Contact Page
          kglad Adobe Community Professional & MVP

          you'll need to use server-side coding to send an email without opening the user's email client.

          • 2. Re: HELP Contact Page
            PrintingByDBE Level 1

            thanks for the reply!!

             

            and do you know how i would do that!!

             

            sry still new to flash n coding!!

             

            • 3. Re: HELP Contact Page
              kglad Adobe Community Professional & MVP

              first you have to find out what languages your server supports.  start with php.  does your server support php?

              1 person found this helpful
              • 4. Re: HELP Contact Page
                PrintingByDBE Level 1

                i am using Godaddy.com

                to host my site...

                • 5. Re: HELP Contact Page
                  kglad Adobe Community Professional & MVP

                  in a plain text editor create file named emal.php and add the below code.   you'll also need some code in your flash.  are you using as2 or as3?

                   

                  <?php

                   

                  $emailRecipient = "your email address should go here";
                  $emailHeaders = "From: youremail@godaddy.com\r\nContent-type: text/html\r\n";
                  $emailHeaders .= "Reply-To: " .$_POST["userEmail"]. "\r\n";
                  $emailHeaders .= "\r\n";

                   

                  foreach ($_POST as $key => $value) {
                     $$key = stripslashes($value);
                  }

                   

                  $emailBody = "<HTML>
                  <BODY>
                  <TABLE BORDER='1'>
                  <TR>
                  <TD align='left' width='780'>Email  : ".$userEmail."</TD>
                  </TR>
                  <TR>
                  <TD align='left' width='780'>Name   : ".$userName."</TD>
                  </TR>
                  <TR>
                  <TD align='left' width='780'>Message: <br><br>".$userMessage."</TD>
                  </TR>
                  </TABLE>
                  </BODY>
                  </HTML>";

                   

                  if(mail($emailRecipient, "kglad Form\n\n", $emailBody, $emailHeaders)){
                    echo "var1=success";
                  } else {
                    echo "var1=failure";
                  }

                   

                  ?>

                  1 person found this helpful
                  • 6. Re: HELP Contact Page
                    PrintingByDBE Level 1

                    im using Action Script 3

                    n Tnx

                    • 7. Re: HELP Contact Page
                      kglad Adobe Community Professional & MVP

                      if you have input textfields userName, userEmail and userMessage, you can use the following in your flash:

                       

                      var urlLdr:URLLoader =  new URLLoader();

                      var urlReq:URLRequest = new URLRequest("email.php");

                       

                      var urlVar:URLVariables=new URLVariables();

                       

                      submitBtn.addEventListener(MouseEvent.CLICK,submitF);

                       

                      function submitF(e:MouseEvent){

                      urlVar.userName = userName.text;

                      urlVar.userEmail = userEmail.text;

                      urlVar.userMessage = userMessage.text

                       

                      urlReq.data=urlVar;
                      urlReq.method="POST";

                      urlLdr.load(urlReq);

                      }

                      • 8. Re: HELP Contact Page
                        PrintingByDBE Level 1

                        ... WOW...

                        thanks for all the help KGLAD !!!

                         

                        i will try it out now and i will let youknow how it works!!!

                        • 9. Re: HELP Contact Page
                          PrintingByDBE Level 1

                          ok so i tried it..

                           

                          the5150crew.com (contact page)

                           

                          i havnt gotten errors but its not sending?

                           

                          when i made the email.php

                           

                          i opened text editor (mac)

                           

                          then entered code and renamed the .txt to .php

                           

                          does it have anything to do woith the .php  code...

                           

                          i didnt change ur code just copy n paste... (i highlighted areas maybe i should change?)

                           

                           

                           

                           

                          <?php

                          $emailRecipient = "your email address should go here";&#8232;$emailHeaders = "From: youremail@godaddy.com\r\nContent-type: text/html\r\n";&#8232;$emailHeaders .= "Reply-To: " .$_POST["userEmail"]. "\r\n";&#8232;$emailHeaders .= "\r\n";

                          foreach ($_POST as $key => $value) {&#8232;   $$key = stripslashes($value);&#8232;}

                          $emailBody = "<HTML>&#8232;<BODY>&#8232;<TABLE BORDER='1'>&#8232;<TR>&#8232;<TD align='left' width='780'>Email  : ".$userEmail."</TD>&#8232;</TR>&#8232;<TR>&#8232;<TD align='left' width='780'>Name   : ".$userName."</TD>&#8232;</TR>&#8232;<TR>&#8232;<TD align='left' width='780'>Message: <br><br>".$userMessage."</TD>&#8232;</TR>&#8232;</TABLE>&#8232;</BODY>&#8232;</HTML>";

                          if(mail($emailRecipient, "kglad Form\n\n", $emailBody, $emailHeaders)){&#8232;  echo "var1=success";&#8232;} else {&#8232;  echo "var1=failure";&#8232;}

                          ?>

                          • 10. Re: HELP Contact Page
                            PrintingByDBE Level 1

                            thanks for the help!


                            • 11. Re: HELP Contact Page
                              kglad Adobe Community Professional & MVP

                              you replaced the red code and have it all working now?

                              • 12. Re: HELP Contact Page
                                PrintingByDBE Level 1

                                hmmm... ok so i changed the info in the .php ill show u...

                                 

                                im not sure about that red selection...

                                 

                                <?php

                                $emailRecipient = "admin@the5150crew.com";&#8232;$emailHeaders = "From: admin@the5150crew.com\r\nContent-type: text/html\r\n";&#8232;$emailHeaders .= "Reply-To: " .$_POST["userEmail"]. "\r\n";&#8232;$emailHeaders .= "\r\n";

                                foreach ($_POST as $key => $value) {&#8232;   $$key = stripslashes($value);&#8232;}

                                $emailBody = "<HTML>&#8232;<BODY>&#8232;<TABLE BORDER='1'>&#8232;<TR>&#8232;<TD align='left' width='780'>Email  : ".$userEmail."</TD>&#8232;</TR>&#8232;<TR>&#8232;<TD align='left' width='780'>Name   : ".$userName."</TD>&#8232;</TR>&#8232;<TR>&#8232;<TD align='left' width='780'>Message: <br><br>".$userMessage."</TD>&#8232;</TR>&#8232;</TABLE>&#8232;</BODY>&#8232;</HTML>";

                                if(mail($emailRecipient, "admin form\n\n", $emailBody, $emailHeaders)){&#8232;  echo "var1=success";&#8232;} else {&#8232;  echo "var1=failure";&#8232;}

                                ?>

                                • 13. Re: HELP Contact Page
                                  kglad Adobe Community Professional & MVP

                                  i think that's ok but it's hard to read with the extraneous &#8232;

                                  • 14. Re: HELP Contact Page
                                    PrintingByDBE Level 1

                                    hmmmm i dont know what happened with all that extra "STUFF"

                                     

                                    ill re-write ur code and try it again...

                                     

                                    that was weird...

                                    • 15. Re: HELP Contact Page
                                      PrintingByDBE Level 1

                                      <?php

                                       


                                      $emailRecipient = "admin@the5150crew.com";
                                      $emailHeaders = "From: admin@the5150crew.com\r\nContent-type: text/html\r\n";
                                      $emailHeaders .= "Reply-To: " .$_POST["userEmail"]. "\r\n";
                                      $emailHeaders .= "\r\n";

                                       


                                      foreach ($_POST as $key => $value) {
                                         $$key = stripslashes($value);
                                      }

                                       


                                      $emailBody = "<HTML>
                                      <BODY>
                                      <TABLE BORDER='1'>
                                      <TR>
                                      <TD align='left' width='780'>Email  : ".$userEmail."</TD>
                                      </TR>
                                      <TR>
                                      <TD align='left' width='780'>Name   : ".$userName."</TD>
                                      </TR>
                                      <TR>
                                      <TD align='left' width='780'>Message: <br><br>".$userMessage."</TD>
                                      </TR>
                                      </TABLE>
                                      </BODY>
                                      </HTML>";

                                       


                                      if(mail($emailRecipient, "Admin Form\n\n", $emailBody, $emailHeaders)){
                                        echo "var1=success";
                                      } else {
                                        echo "var1=failure";
                                      }

                                       


                                      ?>
                                      • 16. Re: HELP Contact Page
                                        kglad Adobe Community Professional & MVP

                                        that looks good.

                                         

                                        if it doesn't work, make sure your php file is named the same as the string used to call it in flash.

                                        • 17. Re: HELP Contact Page
                                          PrintingByDBE Level 1

                                          lol this is driving me crazy!!!

                                           

                                          heres my flash code maybe u can see something wrong?   PS THANKS FOR THE HELP LIKE ALWAYS!!!

                                           

                                           

                                          var urlLdr:URLLoader =  new URLLoader();

                                           

                                          var urlReq:URLRequest = new URLRequest("email.php");

                                           

                                           

                                          var urlVar:URLVariables=new URLVariables();

                                           

                                           

                                          submitBtn.addEventListener(MouseEvent.CLICK,submitF);

                                           

                                           

                                          function submitF(e:MouseEvent){

                                           

                                          urlVar.Name = Name.text;

                                           

                                          urlVar.Email = Email.text;

                                           

                                          urlVar.Message = Message.text

                                           

                                           

                                          urlReq.data=urlVar;

                                           

                                          urlReq.method="POST";

                                           

                                          urlLdr.load(urlReq);

                                           

                                          }

                                           

                                           

                                          HERES THE PHP (does it matter how i saved it cuz i just renamed it a .php instaed of .txt???

                                           

                                           

                                          <?php

                                           


                                          $emailRecipient = "admin@the5150crew.com";
                                          $emailHeaders = "From: admin@the5150crew.com\r\nContent-type: text/html\r\n";
                                          $emailHeaders .= "Reply-To: " .$_POST["userEmail"]. "\r\n";
                                          $emailHeaders .= "\r\n";

                                           


                                          foreach ($_POST as $key => $value) {
                                             $$key = stripslashes($value);
                                          }

                                           


                                          $emailBody = "<HTML>
                                          <BODY>
                                          <TABLE BORDER='1'>
                                          <TR>
                                          <TD align='left' width='780'>Email  : ".$userEmail."</TD>
                                          </TR>
                                          <TR>
                                          <TD align='left' width='780'>Name   : ".$userName."</TD>
                                          </TR>
                                          <TR>
                                          <TD align='left' width='780'>Message: <br><br>".$userMessage."</TD>
                                          </TR>
                                          </TABLE>
                                          </BODY>
                                          </HTML>";

                                           


                                          if(mail($emailRecipient, "Admin@the5150crew.com\n\n", $emailBody, $emailHeaders)){
                                            echo "var1=success";
                                          } else {
                                            echo "var1=failure";
                                          }

                                           


                                          ?>

                                          • 18. Re: HELP Contact Page
                                            kglad Adobe Community Professional & MVP

                                            is the name of your php file email.php and is it in the same directory as your html and swf files?  if so, what's the url to your html?

                                            • 19. Re: HELP Contact Page
                                              PrintingByDBE Level 1

                                              ok lemme see if i can answer your questions..  lol

                                               

                                              the .php file is named email.php

                                               

                                              as for the directorie!?

                                               

                                              i use fetch to connect to the "server" and i just drop the files individually into there..?

                                               

                                               

                                              and the url for my site is the5150crew.com!!!

                                               

                                              I HOPE THIS HELPED

                                              • 20. Re: HELP Contact Page
                                                kglad Adobe Community Professional & MVP

                                                it doesn't look like your enter button does anything.  is it supposed to?

                                                • 21. Re: HELP Contact Page
                                                  PrintingByDBE Level 1

                                                  well it should send the message!!

                                                   

                                                  im guessing my links for the button are wrong...

                                                  • 22. Re: HELP Contact Page
                                                    kglad Adobe Community Professional & MVP

                                                    show the code for your button.

                                                    • 23. Re: HELP Contact Page
                                                      PrintingByDBE Level 1

                                                      hey Kglad heres all the coding on my contact page!!

                                                      it looks like i dont have any calls for the button??

                                                       

                                                      HAVE A GREAT WEEKEND!!


                                                      var urlLdr:URLLoader =  new URLLoader();

                                                       

                                                      var urlReq:URLRequest = new URLRequest("email.php");

                                                       

                                                       

                                                       

                                                      var urlVar:URLVariables=new URLVariables();

                                                       

                                                       

                                                       

                                                      submitBtn.addEventListener(MouseEvent.CLICK,submitF);

                                                       

                                                       

                                                       

                                                      function submitF(e:MouseEvent){

                                                       

                                                      urlVar.Name = Name.text;

                                                       

                                                      urlVar.Email = Email.text;

                                                       

                                                      urlVar.Message = Message.text

                                                       

                                                       

                                                       

                                                      urlReq.data=urlVar;
                                                      urlReq.method="POST";

                                                       

                                                      urlLdr.load(urlReq);

                                                       

                                                      }

                                                      • 24. Re: HELP Contact Page
                                                        kglad Adobe Community Professional & MVP

                                                        somewhere you started to change my code.  use:

                                                         


                                                        var urlLdr:URLLoader =  new URLLoader();

                                                        urlLdr.dataFormat=URLLoaderDataFormat.VARIABLES;

                                                         

                                                        var urlReq:URLRequest = new URLRequest("email.php");

                                                         

                                                         

                                                         

                                                        var urlVar:URLVariables=new URLVariables();

                                                         

                                                         

                                                         

                                                        submitBtn.addEventListener(MouseEvent.CLICK,submitF);

                                                         

                                                         

                                                         

                                                        function submitF(e:MouseEvent){

                                                         

                                                        urlVar.userName = Name.text;

                                                         

                                                        urlVar.userEmail = Email.text;

                                                         

                                                        urlVar.userMessage = Message.text

                                                         

                                                         

                                                         

                                                        urlReq.data=urlVar;
                                                        urlReq.method="POST";

                                                         

                                                        urlLdr.load(urlReq);

                                                         

                                                        }

                                                        • 25. Re: HELP Contact Page
                                                          swif mcvay

                                                          Hi

                                                           

                                                          I seem to have a simliar problem,

                                                           

                                                          I am hosting my site with spry.com

                                                           

                                                          and am using a php form

                                                           

                                                          <?php


                                                          $sendTo = "degrees28@hotmail.co.uk";
                                                          $subject = "Enquiry from Your Website";


                                                          $headers = "From: " . $_POST["name"] . "<" . $_POST["email"] .">\r\n";

                                                          $headers .= "Reply-To: " . $_POST["email"] . "\r\n";

                                                          $headers .= "Return-path: " . $_POST["email"];


                                                          $message = "Company: " . $_POST["message"] . "\r\n" . "Subject: " . $_POST["message2"]. "\r\n" . "Message: " . $_POST["message3"];

                                                           

                                                          mail($sendTo, $subject, $message, $headers);

                                                          ?>

                                                           

                                                           

                                                          but what happens is when i click on my form and fill in the fields, and click send, it doesnt clear the form and send the email,

                                                           

                                                          I got hold of Spry.com and asked them if they supported PHP, for some reason they said they dont cause of spam??????

                                                           

                                                           

                                                          is there any other way to get my flash form to work????

                                                           

                                                          Thanks

                                                          • 26. Re: HELP Contact Page
                                                            kglad Adobe Community Professional & MVP

                                                            i responded to your thread.  please don't continue posting in this thread.

                                                            • 27. Re: HELP Contact Page
                                                              PrintingByDBE Level 1

                                                              Hello Kglad i hope you had a nice relaxing weekend!

                                                              i basically restarted... i copied your .php code again and the flash code i attached the codes in boxes ( to try to be neater ) and also attached the error message i got when i tried to "test the movie"

                                                               

                                                              ALSO not sure if it helps but my text input fields are titled Name, Email, Message... Not userName, userEmail, userMessage

                                                               

                                                              I ALSO ATTACHED AN IMAGE OF THE ERROR CODE BELOW

                                                              Flash Code
                                                              var urlLdr:URLLoader =  new URLLoader();

                                                              urlLdr.dataFormat=URLLoaderDataFormat.VARIABLES;



                                                              var urlReq:URLRequest = new URLRequest("email.php");







                                                              var urlVar:URLVariables=new URLVariables();







                                                              submitBtn.addEventListener(MouseEvent.CLICK,submitF);







                                                              function submitF(e:MouseEvent){



                                                              urlVar.userName = Name.text;



                                                              urlVar.userEmail = Email.text;



                                                              urlVar.userMessage = Message.text







                                                              urlReq.data=urlVar;
                                                              urlReq.method="POST";



                                                              urlLdr.load(urlReq);



                                                              }
                                                              PHP CODE

                                                               

                                                              here is the email.php - still have no clue what the admin Form is or does? i just changed kglad Form to admin Form?

                                                              if(mail($emailRecipient, "admin Form\n\n", $emailBody, $emailHeaders)){

                                                              <?php

                                                               

                                                              $emailRecipient = "admin@the5150crew.com";
                                                              $emailHeaders = "From: admin@the5150crew.com\r\nContent-type: text/html\r\n";
                                                              $emailHeaders = "Reply-To: " .$_POST["userEmail"]. "\r\n";
                                                              $emailHeaders = "\r\n";

                                                               

                                                              foreach ($_POST as $key => $value) {
                                                                 $$key = stripslashes($value);
                                                              }

                                                               

                                                              $emailBody = "<HTML>
                                                              <BODY>
                                                              <TABLE BORDER='1'>
                                                              <TR>
                                                              <TD align='left' width='780'>Email  : ".$Email."</TD>
                                                              </TR>
                                                              <TR>
                                                              <TD align='left' width='780'>Name   : ".$Name."</TD>
                                                              </TR>
                                                              <TR>
                                                              <TD align='left' width='780'>Message: <br><br>".$Message."</TD>
                                                              </TR>
                                                              </TABLE>
                                                              </BODY>
                                                              </HTML>";

                                                               

                                                              if(mail($emailRecipient, "admin Form\n\n", $emailBody, $emailHeaders)){
                                                                echo "var1=success";
                                                              } else {
                                                                echo "var1=failure";
                                                              }

                                                               

                                                              ?>

                                                              • 28. Re: HELP Contact Page
                                                                kglad Adobe Community Professional & MVP

                                                                that code works for me.   you can test here and send emails to yourself:

                                                                 

                                                                http://www.kglad.com/Files/Untitled-1.html

                                                                • 29. Re: HELP Contact Page
                                                                  PrintingByDBE Level 1

                                                                  hmmm...

                                                                   

                                                                  when i click the link its a blank white page.. with boxes

                                                                   

                                                                  but when i enter the info  click send it stays like mine!

                                                                   

                                                                   

                                                                  lol i hope i dont have to like start all over with the design... lol

                                                                  • 30. Re: HELP Contact Page
                                                                    kglad Adobe Community Professional & MVP

                                                                    check your email at admin@the5150crew.com

                                                                    • 31. Re: HELP Contact Page
                                                                      PrintingByDBE Level 1

                                                                      oh wow!!!

                                                                       

                                                                      hahahaha im so excited!!!

                                                                      finaly it worked!!!

                                                                       

                                                                      im sry i havnt checked the inbox!

                                                                       

                                                                      THANK YOU SO MUCH KGLAD!!!

                                                                       

                                                                      • 32. Re: HELP Contact Page
                                                                        kglad Adobe Community Professional & MVP

                                                                        you're welcome.