Send Mail via php using Flash 8

  • contutti
  • Born
  • Born
  • No Avatar
  • Joined: Jul 03, 2008
  • Posts: 2
  • Status: Offline

Post July 4th, 2008, 9:36 am

ATNO/TW wrote:
Make sure you've disable the <> button on all fields.

After you've made your changes and published your file, before you test it on your website, make sure you've cleared your brower's cache/temporary internet files. Most likely you are loading a cached version of the swf that didn't work right.


Yep, already tried that. Still don't working.
With strip_tags in PHP code I managed to "trick" the flash and therefore achieve my objective.
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post July 4th, 2008, 9:36 am

  • lolo73
  • Born
  • Born
  • No Avatar
  • Joined: Mar 30, 2009
  • Posts: 1
  • Status: Offline

Post March 30th, 2009, 9:07 am

ok here is what i have
Code: [ Select ]
on (release) {
if (name eq "" or phone eq "" or email eq "" or message eq "") {
     error.gotoAndPlay("error");
} else {
     loadVariablesNum("vmail.php", 0, "POST");
     error.gotoAndPlay("sent");
     name = "";
     phone = "";
     email = "";
     message = "";
}
}
  1. on (release) {
  2. if (name eq "" or phone eq "" or email eq "" or message eq "") {
  3.      error.gotoAndPlay("error");
  4. } else {
  5.      loadVariablesNum("vmail.php", 0, "POST");
  6.      error.gotoAndPlay("sent");
  7.      name = "";
  8.      phone = "";
  9.      email = "";
  10.      message = "";
  11. }
  12. }


I want what that it moves on to a page and says "thanks your mail is sent" cheaks to see if the email is valid.
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Joined: May 28, 2003
  • Posts: 23404
  • Loc: Woodbridge VA
  • Status: Offline

Post March 30th, 2009, 10:16 am

if (name eq "" or phone eq "" or email eq "" or message eq "")

That line actually checks to make sure the required inputs are filled in. In this case the reuired inputs are name, phone, email and message. What it does not do is check that the email address is formatted validly. You could do that in your vmail.php script if you wanted.

In that example "error" and "sent" are frame labels in the movie. The error.gotoAndPlay("error"); takes them to the frame labeled "error" and there you would let them know that they didn't fill out all the required fields. The error.gotoAndPlay("sent"); takes them to the frame labeled "sent" where you would display "thanks your mail is sent"
"There's no place like 127.0.0.1 except for ::1."
Alexandria Networks. Leader in IT consulting for associations/non-profits, and small to medium sized businesses around the northern Virginia and Washington D.C. metro area.
  • gmoeller54
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Jan 15, 2010
  • Posts: 10
  • Status: Offline

Post January 15th, 2010, 4:22 pm

Greetings...
I have been using a flash--> php email form on my sites and the same server for years...
I really like the code that you came up with because of its requirement of completed fields (I have received numerous 'ghost' emails from my sites over the years)

Unfortunately, I can't get it to work...
Using flash 10 AS2

My variable buttons in flash are:
name
company
phone
email
message

here is my code on the submit button:

ACTIONSCRIPT Code: [ Select ]
on (release) {
     if (name eq "" or phone eq "" or email eq "" or message eq "") {
         error.gotoAndPlay("error");
     } else {
         loadVariablesNum("vmail.php", 0, "POST");
         error.gotoAndPlay("sent");
         name = "";
       company = "";
         phone = "";
         email = "";
         message = "";
     }
 }
  1. on (release) {
  2.      if (name eq "" or phone eq "" or email eq "" or message eq "") {
  3.          error.gotoAndPlay("error");
  4.      } else {
  5.          loadVariablesNum("vmail.php", 0, "POST");
  6.          error.gotoAndPlay("sent");
  7.          name = "";
  8.        company = "";
  9.          phone = "";
  10.          email = "";
  11.          message = "";
  12.      }
  13.  }



and the vmail.php:

PHP Code: [ Select ]
<?php
      if (isset($HTTP_POST_VARS)) {
   
          $name = $HTTP_POST_VARS["name"];
        $company = $HTTP_POST_VARS["company"];
          $phone = $HTTP_POST_VARS["phone"];
   
          $email =     $HTTP_POST_VARS["email"];
   
          $message = $HTTP_POST_VARS["message"];
 
              }
   
   
     $to = "samplemail<at>email<dot>com";
     $subject = "SILICONE BOOK SITE CONTACT";
     $msg .= "Senders Name: " ."$name\n\n";  
     $msg .= "Sender's Company: " ."$company\n\n";
     $msg .= "Phone: " ."$phone\n\n";
     $msg .= "Email: " ."$email\n\n";
   
     $msg .= "Message: " ."$message\n\n";
     $msg .= "This message was sent to you from My Site Contact  Form.\n\n";
   
     $msg .= "Do not reply to this email directly.";
   
   
     mail($to, $subject, $msg, "From: My Site Contact Form\nReply-To: $email\n");
   
   
   ?>
  1. <?php
  2.       if (isset($HTTP_POST_VARS)) {
  3.    
  4.           $name = $HTTP_POST_VARS["name"];
  5.         $company = $HTTP_POST_VARS["company"];
  6.           $phone = $HTTP_POST_VARS["phone"];
  7.    
  8.           $email =     $HTTP_POST_VARS["email"];
  9.    
  10.           $message = $HTTP_POST_VARS["message"];
  11.  
  12.               }
  13.    
  14.    
  15.      $to = "samplemail<at>email<dot>com";
  16.      $subject = "SILICONE BOOK SITE CONTACT";
  17.      $msg .= "Senders Name: " ."$name\n\n";  
  18.      $msg .= "Sender's Company: " ."$company\n\n";
  19.      $msg .= "Phone: " ."$phone\n\n";
  20.      $msg .= "Email: " ."$email\n\n";
  21.    
  22.      $msg .= "Message: " ."$message\n\n";
  23.      $msg .= "This message was sent to you from My Site Contact  Form.\n\n";
  24.    
  25.      $msg .= "Do not reply to this email directly.";
  26.    
  27.    
  28.      mail($to, $subject, $msg, "From: My Site Contact Form\nReply-To: $email\n");
  29.    
  30.    
  31.    ?>


It is not going to my labelled frames "error" or "sent" nor is it sending anything to my email...

pleez help!
thanx
Moderator Remark: corrected code display problem
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Joined: May 28, 2003
  • Posts: 23404
  • Loc: Woodbridge VA
  • Status: Offline

Post January 15th, 2010, 5:33 pm

The code looks fine. I can't see anything that would cause it not to work. Can you provide any additional information?
"There's no place like 127.0.0.1 except for ::1."
Alexandria Networks. Leader in IT consulting for associations/non-profits, and small to medium sized businesses around the northern Virginia and Washington D.C. metro area.
  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Joined: Jul 11, 2005
  • Posts: 1828
  • Loc: In the Great White North
  • Status: Offline

Post January 18th, 2010, 3:40 pm

There's a good chance its a scope issue. I assume the code is working correctly but flash can't find the content outside of the on(release). Basically Flash is looking for variables with those names INSIDE the button. Without being able to see the structure of your swf, I'm betting that you'll need something like
ACTIONSCRIPT Code: [ Select ]
var name = this._parent.name.text;
If at first you don't succeed F1... If that doesn't work try Google!
//// Designer, Developer & Teacher - Interactive, Motion and 3D \\\\
Portfolio at WhenImNotSleeping.com
  • gmoeller54
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Jan 15, 2010
  • Posts: 10
  • Status: Offline

Post January 20th, 2010, 1:18 pm

Hi guys
And thank you for your responses.

I tried putting the variable calls in the actionscript as well.
Not helping.

I zipped up the .fla (CS4) and the vmail.php.
I am baffled.
Your help would be greatly appreciated!


soldesigns(dot)com/silicone/gmoeller_contact_form.zip
  • gmoeller54
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Jan 15, 2010
  • Posts: 10
  • Status: Offline

Post January 23rd, 2010, 12:28 pm

can you guys access the .zip?
is this a good way to share the files?
thanx
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Joined: May 28, 2003
  • Posts: 23404
  • Loc: Woodbridge VA
  • Status: Offline

Post January 25th, 2010, 9:09 am

I was finally able to download it this morning, but I can't open the FLA. For some reason using CS3 it tells me it's an invalid file format. Perhaps because you are doing this on a mac?

Regardless I think it's possible that your problem is in your php file.

I don't know what it is about this post but you notice in your initial one I edited your post to correct the code. But for some reason when you copy the php code from here it wants to add a span tag.
Specifically:

Code: [ Select ]
$<span class="posthilit">email</span> = $HTTP_POST_VARS["<span class="posthilit">email</span>"];


Code: [ Select ]
$msg .= "<span class="posthilit">Email</span>: " ."$<span class="posthilit">email</span>\n\n";


Code: [ Select ]
$msg .= "Do not reply to this <span class="posthilit">email</span> directly.";


Code: [ Select ]
mail($to, $subject, $msg, "From: My Site Contact Form\nReply-To: $<span class="posthilit">email</span>\n");


Remove all the span tags from there. They aren't supposed to be there and could easily be preventing your email from working.

If that isn't it, perhaps somebody with a MAC can look at your FLA.
"There's no place like 127.0.0.1 except for ::1."
Alexandria Networks. Leader in IT consulting for associations/non-profits, and small to medium sized businesses around the northern Virginia and Washington D.C. metro area.
  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Joined: Jul 11, 2005
  • Posts: 1828
  • Loc: In the Great White North
  • Status: Offline

Post January 25th, 2010, 9:15 am

Mark its a CS4 file. Adobe changed it so they're not backward compatible. I'll try to grab it today and take a look.
If at first you don't succeed F1... If that doesn't work try Google!
//// Designer, Developer & Teacher - Interactive, Motion and 3D \\\\
Portfolio at WhenImNotSleeping.com
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Joined: May 28, 2003
  • Posts: 23404
  • Loc: Woodbridge VA
  • Status: Offline

Post January 25th, 2010, 10:44 am

Thanks. I still think it's simply just the php though. The vmail.php included in the zip has the span tags. So if that's what is being used for the mail script it's wrong and it will fail.
"There's no place like 127.0.0.1 except for ::1."
Alexandria Networks. Leader in IT consulting for associations/non-profits, and small to medium sized businesses around the northern Virginia and Washington D.C. metro area.
  • gmoeller54
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Jan 15, 2010
  • Posts: 10
  • Status: Offline

Post January 27th, 2010, 3:48 pm

Hi guys...
Thanks for trying to dig into this!

I changed the .php into this:


<?php
if (isset($HTTP_POST_VARS)) {

$name = $HTTP_POST_VARS["name"];
$company = $HTTP_POST_VARS["company"];
$phone = $HTTP_POST_VARS["phone"];

$email = $HTTP_POST_VARS["email"];

$message = $HTTP_POST_VARS["message"];

}

$to = "email at gmail dot com";

$subject = "SILICONE BOOK SITE CONTACT";

$msg .= "Senders Name: " ."$name\n\n";

$msg .= "Sender's Company: " ."$company\n\n";

$msg .= "Phone: " ."$phone\n\n";

$msg .= "Email: " ."$email\n\n";

$msg .= "Message: " ."$message\n\n";

$msg .= "This message was sent to you from My Site Contact Form.\n\n";

$msg .= "Do not reply to this email directly.";

mail($to, $subject, $msg, "From: My Site Contact Form\nReply-To: $email\n");

?>

Basically took out the span tags
No luck

It is still not sending to my email, nor is it going to my labelled frames "error" or "sent"

My FLA is CS4-sorry :(
  • gmoeller54
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Jan 15, 2010
  • Posts: 10
  • Status: Offline

Post February 1st, 2010, 10:30 am

any takers?
really would like to get this bad boy working!
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Joined: May 28, 2003
  • Posts: 23404
  • Loc: Woodbridge VA
  • Status: Offline

Post February 1st, 2010, 12:17 pm

I don't have CS4 and it won't open in CS3. I can't offer any more ideas. Someone with CS4 will have to look.
"There's no place like 127.0.0.1 except for ::1."
Alexandria Networks. Leader in IT consulting for associations/non-profits, and small to medium sized businesses around the northern Virginia and Washington D.C. metro area.
  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Joined: Jul 11, 2005
  • Posts: 1828
  • Loc: In the Great White North
  • Status: Offline

Post February 1st, 2010, 1:01 pm

I don't have time to look into this today. But here's a CS3 version of the file...

http://addsomespark.com/client/ozzu/gmoeller_contact_form.zip
If at first you don't succeed F1... If that doesn't work try Google!
//// Designer, Developer & Teacher - Interactive, Motion and 3D \\\\
Portfolio at WhenImNotSleeping.com
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post February 1st, 2010, 1:01 pm

Post Information

  • Total Posts in this topic: 59 posts
  • Users browsing this forum: No registered users and 59 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.