Send Mail via php using Flash 8

  • Heart
  • Expert
  • Expert
  • User avatar
  • Posts: 633
  • Loc: Welcome To, Crazy World!

Post 3+ Months Ago

Hey guys! I have a problem for you guys. I have done a send mail via php using variables in flash but currently I am having some problems getting it to send for me on a different site that I am currently working on. It's not sending at all for me. I don't even get an blank email or anything else sent. I don't know if it's because I am using Flash 8 now or what the problem is. I am hoping it's a small error or something that I am over looking and maybe one of you can see what I can not.


Script for my send button:
Code: [ Select ]
on (release) {
    info.loadVariables("vmail.php", "POST");
    
    info.txt1 = "Name:";
    info.txt2 = "E-Mail:";
    info.txt3 = "Phone:";
    info.txt6 = "Message:";
    
    this.gotoAndStop(2);
}
  1. on (release) {
  2.     info.loadVariables("vmail.php", "POST");
  3.     
  4.     info.txt1 = "Name:";
  5.     info.txt2 = "E-Mail:";
  6.     info.txt3 = "Phone:";
  7.     info.txt6 = "Message:";
  8.     
  9.     this.gotoAndStop(2);
  10. }


My php script:
Code: [ Select ]
<?php
$sendTo = "mail@mail.com";
$subject = "SITE CONTACT";
$headers = "From: " . $_POST["txt1"];
$headers .= "Reply-To: " . $_POST["txt2"];
$headers .= "Return-path: " . $_POST["txt2"];
$message = $_POST["txt1"] . $_POST["txt2"] . $_POST["txt3"] . $_POST["txt6"];
mail($sendTo, $subject, $message, $headers);
?>
  1. <?php
  2. $sendTo = "mail@mail.com";
  3. $subject = "SITE CONTACT";
  4. $headers = "From: " . $_POST["txt1"];
  5. $headers .= "Reply-To: " . $_POST["txt2"];
  6. $headers .= "Return-path: " . $_POST["txt2"];
  7. $message = $_POST["txt1"] . $_POST["txt2"] . $_POST["txt3"] . $_POST["txt6"];
  8. mail($sendTo, $subject, $message, $headers);
  9. ?>


txt1 = name
txt2 = email
txt3 = phone
txt6 = message

You should know that "info" is a movieclip that I am storing my variables (txt1-6). And I am sure that I have all of them labeled for instance and var:.

here is a screen shot of it in case you are wondering why things are the way that they are:
Image

Any solutions or suggestions please let me know! Thank you for our help!
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23473
  • Loc: Woodbridge VA

Post 3+ Months Ago

Not certain why you need the "info". Also you aren't allowing for empty required fields which means you could get a lot of emails with missing or no information. Really you would want something in all those fields so I'd set it up something like this. (of course you'd have to supply an "error" message and a "sent" message using the appropriate labels to go to that part of the timeline. This is essentially how mine are set up.

For your action:

Code: [ Select ]
//note - I would replace your txt1, txt2,txt3 and txt6 labels with name, phone, email and message respectively

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. //note - I would replace your txt1, txt2,txt3 and txt6 labels with name, phone, email and message respectively
  2. on (release) {
  3.     if (name eq "" or phone eq "" or email eq "" or message eq "") {
  4.         error.gotoAndPlay("error");
  5.     } else {
  6.         loadVariablesNum("vmail.php", 0, "POST");
  7.         error.gotoAndPlay("sent");
  8.         name = "";
  9.         phone = "";
  10.         email = "";
  11.         message = "";
  12.     }
  13. }



then for vmail.php I would have the following (I assume mail@mail.com is bogus and you would have a real one there)

PHP Code: [ Select ]
<?
 
    if (isset($HTTP_POST_VARS)) {
 
           
 
            $name = $HTTP_POST_VARS["name"];
 
            $phone = $HTTP_POST_VARS["phone"];
 
            $email = $HTTP_POST_VARS["email"];
 
            $message = $HTTP_POST_VARS["message"];
 
            }
 
 
 
   $to = "mail@mail.com";
 
   $subject = "SITE CONTACT";
 
   $msg .= "Senders Name: " ."$name\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. <?
  2.  
  3.     if (isset($HTTP_POST_VARS)) {
  4.  
  5.            
  6.  
  7.             $name = $HTTP_POST_VARS["name"];
  8.  
  9.             $phone = $HTTP_POST_VARS["phone"];
  10.  
  11.             $email = $HTTP_POST_VARS["email"];
  12.  
  13.             $message = $HTTP_POST_VARS["message"];
  14.  
  15.             }
  16.  
  17.  
  18.  
  19.    $to = "mail@mail.com";
  20.  
  21.    $subject = "SITE CONTACT";
  22.  
  23.    $msg .= "Senders Name: " ."$name\n\n";
  24.  
  25.    $msg .= "Phone: " ."$phone\n\n";
  26.  
  27.    $msg .= "Email: " ."$email\n\n";
  28.  
  29.    $msg .= "Message: " ."$message\n\n";
  30.  
  31.     $msg .= "This message was sent to you from My Site Contact  Form.\n\n";
  32.  
  33.     $msg .= "Do not reply to this email directly.";
  34.  
  35.  
  36.  
  37.   mail($to, $subject, $msg, "From: My Site Contact Form\nReply-To: $email\n");
  38.  
  39.  
  40.  
  41. ?>


Been using that for a couple years and works fine.

//lol - Took me awhile, but I just realized this is you! How ya been old friend?
  • JesterPrime
  • Born
  • Born
  • JesterPrime
  • Posts: 2

Post 3+ Months Ago

Hi I know this is a very old topic but im tryin to get this code to send an auto reply to the sender. Im pretty sure the code is the last bit of this line,

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

Some how I got it to work once but nothing since. Please Help
  • petra825
  • Born
  • Born
  • petra825
  • Posts: 1

Post 3+ Months Ago

Hi,

Thank you so much, this is the first technique that has worked for me so far with Flash 8. I am having one issue, the email that get from the form comes out really weird, it looks like this:

Senders Name: <TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Arial\" SIZE=\"13\" COLOR=\"#000000\" LETTERSPACING=\"0\" KERNING=\"0\">petra vincent</FONT></P></TEXTFORMAT>

subject: SITE CONTACT

Email: <TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Arial\" SIZE=\"13\" COLOR=\"#000000\" LETTERSPACING=\"0\" KERNING=\"0\">info@petra825.com</FONT></P></TEXTFORMAT>

org: <TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Arial\" SIZE=\"13\" COLOR=\"#000000\" LETTERSPACING=\"0\" KERNING=\"0\">my organization</FONT></P></TEXTFORMAT>

Comment: <TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Arial\" SIZE=\"13\" COLOR=\"#000000\" LETTERSPACING=\"0\" KERNING=\"0\"></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Arial\" SIZE=\"13\" COLOR=\"#000000\" LETTERSPACING=\"0\" KERNING=\"0\">this is my comment this is my comment, please work please</FONT></P></TEXTFORMAT>

This message was sent to you from My Site Contact Form.

Do not reply to this email directly.

is there anyway to fix this. Thank you so much in advance.

Best,
Petra
  • JesterPrime
  • Born
  • Born
  • JesterPrime
  • Posts: 2

Post 3+ Months Ago

Hi petra825, since my post I've learnt a lot about how this form works. Not sure why its doing that but if you want to post your AS & php code I'll have a look. JesterP
  • tbenfield
  • Born
  • Born
  • tbenfield
  • Posts: 2

Post 3+ Months Ago

Hello guys, well I have got this email posting working from a flash site with the php using the code posted by ANTO/TW above but as with preta825 above I am getting some weird coding in the email content:
__________________________________________________________________

Senders Name: <TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"verdana\" SIZE=\"10\" COLOR=\"#626C77\" LETTERSPACING=\"0\" KERNING=\"0\">tony</FONT></P></TEXTFORMAT>

Surname: <TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"verdana\" SIZE=\"10\" COLOR=\"#626C77\" LETTERSPACING=\"0\" KERNING=\"0\"></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"verdana\" SIZE=\"10\" COLOR=\"#626C77\" LETTERSPACING=\"0\" KERNING=\"0\">benfield</FONT></P></TEXTFORMAT>

Company: <TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"verdana\" SIZE=\"10\" COLOR=\"#626C77\" LETTERSPACING=\"0\" KERNING=\"0\"></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"verdana\" SIZE=\"10\" COLOR=\"#626C77\" LETTERSPACING=\"0\" KERNING=\"0\">nostalgia bank</FONT></P></TEXTFORMAT>

Email: <TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"verdana\" SIZE=\"10\" COLOR=\"#626C77\" LETTERSPACING=\"0\" KERNING=\"0\">slaes@nostalgiabank</FONT></P></TEXTFORMAT>

Message: <TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"verdana\" SIZE=\"10\" COLOR=\"#626C77\" LETTERSPACING=\"0\" KERNING=\"0\">does this work?</FONT></P></TEXTFORMAT>

Subject:

SITE CONTACT This message was sent to you from My Site Contact Form. Do not reply to this email directly.

__________________________________________________________________

Any advice would really help guys.

Tony
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23473
  • Loc: Woodbridge VA

Post 3+ Months Ago

It looks like in your Flash Form you have Render Text as HTML enabled. Check each of your textInput fields and make sure that is disabled. It's the button that looks like <> just to the right of Single Line in the Properties Inspector.
  • tbenfield
  • Born
  • Born
  • tbenfield
  • Posts: 2

Post 3+ Months Ago

Thanks bud, that resolved the issue.
  • bozboz
  • Novice
  • Novice
  • bozboz
  • Posts: 31
  • Loc: Brighton

Post 3+ Months Ago

Yeah that one confused me for months as well

If your lazy you can use the striptags() function in php as well, do this on the message before its sent. Especially if you cant be bothered to go back and recompile the swf
  • codzprc
  • Born
  • Born
  • codzprc
  • Posts: 2

Post 3+ Months Ago

All of this has been incredibly helpful to me so far - but I have a twist I'd like to add. I'm using this code to send a password to me, as well as the ip address (well, just the password so far) The problem seems to be in my php code - since the Flash shouldn't have anything to do with the IP bit-- right? anyway. Nothing I try is working to relay the IP address through a message... Thank you in advance for help.

my flash code is (explanations below):


Code: [ Select ]
var myPassword:String = 'apples';
var jungle = password_txt.text
 
 
onEnterFrame = function  () {
jungle = password_txt.text
    }
 
submit_mc.onRelease = function (){
       
   loadVariablesNum("vmail.php", 0, "POST");
   jungle = "";
     
 
   if (password_txt.text == myPassword) {
     gotoAndStop("vidz");
   } else {
     gotoAndStop("invalid");
}
}
  1. var myPassword:String = 'apples';
  2. var jungle = password_txt.text
  3.  
  4.  
  5. onEnterFrame = function  () {
  6. jungle = password_txt.text
  7.     }
  8.  
  9. submit_mc.onRelease = function (){
  10.        
  11.    loadVariablesNum("vmail.php", 0, "POST");
  12.    jungle = "";
  13.      
  14.  
  15.    if (password_txt.text == myPassword) {
  16.      gotoAndStop("vidz");
  17.    } else {
  18.      gotoAndStop("invalid");
  19. }
  20. }



PHP code:


Code: [ Select ]
php<?
if (isset($HTTP_POST_VARS)) {
 
$name = $HTTP_POST_VARS["jungle"];
$ip  = $_SERVER['REMOTE_ADDR'];
}
 
$to = "Jim@bob.xom";
$subject = "SITE CONTACT";
$msg .= "Senders Name: " ."$name\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, $name, $msg, $ip );
 
?>/php
  1. php<?
  2. if (isset($HTTP_POST_VARS)) {
  3.  
  4. $name = $HTTP_POST_VARS["jungle"];
  5. $ip  = $_SERVER['REMOTE_ADDR'];
  6. }
  7.  
  8. $to = "Jim@bob.xom";
  9. $subject = "SITE CONTACT";
  10. $msg .= "Senders Name: " ."$name\n\n";
  11. $msg .= "This message was sent to you from My Site Contact Form.\n\n";
  12. $msg .= "Do not reply to this email directly.";
  13.  
  14. mail($to, $subject, $name, $msg, $ip );
  15.  
  16. ?>/php








flash explanation (for those that are wondering about the vars):::

Code: [ Select ]
 
    //set password
var myPassword:String = 'apples';
    //sets password to transfer to a dynamic text field for php reasons
var jungle = password_txt.text
 
   // live updates dynamic field so when they submit the code goes to php
onEnterFrame = function  () {
jungle = password_txt.text
    }
 
submit_mc.onRelease = function (){
       
   loadVariablesNum("vmail.php", 0, "POST");
   jungle = "";
     
 
   if (password_txt.text == myPassword) {
     gotoAndStop("vidz");
   } else {
     gotoAndStop("invalid");
}
}
  1.  
  2.     //set password
  3. var myPassword:String = 'apples';
  4.     //sets password to transfer to a dynamic text field for php reasons
  5. var jungle = password_txt.text
  6.  
  7.    // live updates dynamic field so when they submit the code goes to php
  8. onEnterFrame = function  () {
  9. jungle = password_txt.text
  10.     }
  11.  
  12. submit_mc.onRelease = function (){
  13.        
  14.    loadVariablesNum("vmail.php", 0, "POST");
  15.    jungle = "";
  16.      
  17.  
  18.    if (password_txt.text == myPassword) {
  19.      gotoAndStop("vidz");
  20.    } else {
  21.      gotoAndStop("invalid");
  22. }
  23. }
  • bozboz
  • Novice
  • Novice
  • bozboz
  • Posts: 31
  • Loc: Brighton

Post 3+ Months Ago

try

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

$name = $HTTP_POST_VARS["jungle"];
$ip = $_SERVER['REMOTE_ADDR'];
}

$to = "youremail@yoursite.com";
$subject = "SITE CONTACT";
$msg .= "Senders Name: " ."$name\n\n";
$msg .= "This message was sent to you from My Site ContactForm.\n\n IP address was $ip ";
$msg .= "Do not reply to this email directly.";

mail($to, $subject, $name, $msg);

?>/php
  • codzprc
  • Born
  • Born
  • codzprc
  • Posts: 2

Post 3+ Months Ago

Awesome! That worked perfectly, thanks. So basically it didn't print because it wasn't in quotes?? I'm not very php savvy, as you can tell.

thanks again
  • magic1000
  • Born
  • Born
  • magic1000
  • Posts: 3

Post 3+ Months Ago

Thank all!
  • contutti
  • Born
  • Born
  • contutti
  • Posts: 2

Post 3+ Months Ago

Hi to all. I seem to have the same problem, but I cannot solve it.
I have a form in flash.

The code on "Send" button is (simplified):

on (press) {
loadVariablesNum("mail.php", 0, "POST")
}


My PHP is:
<?php
$sendTo = "(my mail is here)";
$subject = "Message from My page";
$headers = "From: " . $_POST["name"];
$headers .= "<" . $_POST["email"] . ">\r\n";
$headers .= "Reply-To: " . $_POST["email"] . "\r\n";
$headers .= "Return-Path: " . $_POST["email"];
$message = $_POST["message"];
mail($sendTo, $subject, $message, $headers);
?>


And when I recieve the mail, it goes
<TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Arial Narrow\" SIZE=\"14\" COLOR=\"#666666\" LETTERSPACING=\"0\" KERNING=\"0\">Testing message</FONT></P></TEXTFORMAT>
And the same in the "Respond to" field.

I tried:
- Enabling the <> button.
- Disabling the <> button.
- Set A/V to 0
- Changing fonts

Nothing worked... HALP!
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23473
  • Loc: Woodbridge VA

Post 3+ Months Ago

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.
  • contutti
  • Born
  • Born
  • contutti
  • Posts: 2

Post 3+ Months Ago

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.
  • lolo73
  • Born
  • Born
  • lolo73
  • Posts: 1

Post 3+ Months Ago

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
  • Posts: 23473
  • Loc: Woodbridge VA

Post 3+ Months Ago

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"
  • gmoeller54
  • Newbie
  • Newbie
  • gmoeller54
  • Posts: 10

Post 3+ Months Ago

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
  • Posts: 23473
  • Loc: Woodbridge VA

Post 3+ Months Ago

The code looks fine. I can't see anything that would cause it not to work. Can you provide any additional information?
  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Posts: 1827
  • Loc: In the Great White North

Post 3+ Months Ago

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;
  • gmoeller54
  • Newbie
  • Newbie
  • gmoeller54
  • Posts: 10

Post 3+ Months Ago

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
  • gmoeller54
  • Posts: 10

Post 3+ Months Ago

can you guys access the .zip?
is this a good way to share the files?
thanx
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23473
  • Loc: Woodbridge VA

Post 3+ Months Ago

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.
  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Posts: 1827
  • Loc: In the Great White North

Post 3+ Months Ago

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.
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23473
  • Loc: Woodbridge VA

Post 3+ Months Ago

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.
  • gmoeller54
  • Newbie
  • Newbie
  • gmoeller54
  • Posts: 10

Post 3+ Months Ago

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
  • gmoeller54
  • Posts: 10

Post 3+ Months Ago

any takers?
really would like to get this bad boy working!
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23473
  • Loc: Woodbridge VA

Post 3+ Months Ago

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.
  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Posts: 1827
  • Loc: In the Great White North

Post 3+ Months Ago

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
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23473
  • Loc: Woodbridge VA

Post 3+ Months Ago

getting a 404 bryce
  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Posts: 1827
  • Loc: In the Great White North

Post 3+ Months Ago

Try now there was a typo. Sorry.
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23473
  • Loc: Woodbridge VA

Post 3+ Months Ago

OK got it that time. Thanks
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23473
  • Loc: Woodbridge VA

Post 3+ Months Ago

I did find and corrected several issues but had too much going on at work to solve everything before I left. I'll do my best to post it early in the AM.
  • gmoeller54
  • Newbie
  • Newbie
  • gmoeller54
  • Posts: 10

Post 3+ Months Ago

thanks for supplying the CS3 version!
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23473
  • Loc: Woodbridge VA

Post 3+ Months Ago

I still haven't been able to give your file a lot of attention but I can give you some things to get you closer to a working form.

First I'm really not sure why you have the code you do for the reset button. You have:

ACTIONSCRIPT Code: [ Select ]
on (release) {
     getURL("contact.php", "_blank", "GET");
     name = "Your Name:";
     phone = "Your Phone:";
     company = "Your Company:";
     email = "Your Email:";
     message = "Message:";
}
  1. on (release) {
  2.      getURL("contact.php", "_blank", "GET");
  3.      name = "Your Name:";
  4.      phone = "Your Phone:";
  5.      company = "Your Company:";
  6.      email = "Your Email:";
  7.      message = "Message:";
  8. }


First of all you don't have a file contact.php. Even if you do, it isn't going to accomplish what you want with the reset button. To reset you simply want to make your text field variables blank. This is sufficient to do that:

ACTIONSCRIPT Code: [ Select ]
on (release){
     name = "";
     phone = "";
     company = "";
     email = "";
     message = "";
}
  1. on (release){
  2.      name = "";
  3.      phone = "";
  4.      company = "";
  5.      email = "";
  6.      message = "";
  7. }


For your text fields one thing I would suggest is change your fields from multi-line to single-line except for the Message field. I would also suggest putting in some character limits. Your maximum characters are all set to 0. I would change them to approx 30 except for message which I would say around 500 would be fine.

For your submit button you don't really need this
ACTIONSCRIPT Code: [ Select ]
var name = this._parent.name.text
var company = this._parent.company.text
var phone = this._parent.phone.text
var email = this._parent.email.text
var message = this._parent.message.text
  1. var name = this._parent.name.text
  2. var company = this._parent.company.text
  3. var phone = this._parent.phone.text
  4. var email = this._parent.email.text
  5. var message = this._parent.message.text


also for error.gotoAndPlay("error"); and error.gotoAndPlay("send"); lose "error." Just use the gotoAndPlay. In prior posts above "error" is the instance of a movieclip I loaded. You don't have an error movieclip.

After those changes your errors start to display but there is still a problem. If you leave all your fields blank and click submit it should take you to the error clip but it doesn't it takes you to sent. If you add a trace on your variables you'll see that initially it's adding some HTML <p> tags to your text fields and I'm not sure why. Unfortunately I've been too busy to give it any kind of time to trouble shoot. That's as far as I got and won't have any time to look at it again until perhaps this weekend. But that should give you some things to go with.

Also check your Actions on your error and sent tweens. I'm think some of your gotoAndPlay's are set to the wrong frames. In particular the close button.

I'd also suggest moving your error tweens farther on the timeline to where your text fields are hidden. It looks rather amateurish to display the errors over the text fields.

I know that's not a lot but hope it helps you narrow things down.
  • gmoeller54
  • Newbie
  • Newbie
  • gmoeller54
  • Posts: 10

Post 3+ Months Ago

I have gone through all of your suggestions, and it looks as though I have arrived exactly where you left off.

For whatever reason, if you were to leave the fields blank and only hit submit, it doesn't send it to the error frame, but rather to the sent frame.

ACTIONSCRIPT Code: [ Select ]
     if (name eq "" or phone eq "" or email eq "" or message eq "") {
         gotoAndPlay(3);
     } else {
         loadVariablesNum("vmail.php", 0, "POST");
  1.      if (name eq "" or phone eq "" or email eq "" or message eq "") {
  2.          gotoAndPlay(3);
  3.      } else {
  4.          loadVariablesNum("vmail.php", 0, "POST");


This is the code being used to check for empty fields
seems to be skipping right over this...is the syntax correct?

Also, it's not sending to my email anything at all.

I have loaded up the new version, with corrected frame calls.
I also edited the .php because I found a couple more span tags.
soldesigns(dot)com/silicone/gmoeller_contact_form_2_8_10.zip

Would love to get this guy working!
  • gmoeller54
  • Newbie
  • Newbie
  • gmoeller54
  • Posts: 10

Post 3+ Months Ago

Please guys...I would really like to resolve this form...I'll be happy to give a donation if that's what it's going to take...seriously
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23473
  • Loc: Woodbridge VA

Post 3+ Months Ago

I hadn't had the chance to look at what you revised. But that was sort of what I was saying. It isn't skipping over it per se. For some reason when the flash loads, it loads some HTML into those fields (Which you can see if you trace your variables like I suggested). Then after you hit submit or reset the fields are empty. I'll try to look at it again later today, but really going to be pretty busy all weekend. OK actually I'm taking my girlfriend to a casino and Flash is probably going to be the last thing on my mind.


I can't remember exactly what the HTML is but I do remember it was a <p> tag with a text-align attribute. That's where I would troubleshoot. Why that is being added.
  • gmoeller54
  • Newbie
  • Newbie
  • gmoeller54
  • Posts: 10

Post 3+ Months Ago

ha...
i completely understand...
have fun with the girly...

not too sure how to "trace" variables...
but will try to google it...

thanx!
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23473
  • Loc: Woodbridge VA

Post 3+ Months Ago

Trace is simple

trace(name);
trace(message);
etc...

Then when you test your movie it will output the variable contents. If you see nothing they are empty.
In your case something is setting the initial value of the variables to some HTML code and I didn't have time to dig into what was doing it.
  • gmoeller54
  • Newbie
  • Newbie
  • gmoeller54
  • Posts: 10

Post 3+ Months Ago

I'm sorry for being such a pest, but I am having no luck trying to track down what is going on. Could you please look at my file when you have a moment? Thanx!!
  • palmershire
  • Born
  • Born
  • palmershire
  • Posts: 2

Post 3+ Months Ago

When sending my form, using this code:

on (release) {
getURL("mailto:(email)" + "?subject=" +subject+ "&body=" +body);
}


both the subject field and message body show up as:

<p align="left"></p>

or some other odd text when viewed from my email account.

*I've checked both the form fields and neither show the <> mentioned earlier in this forum. I could really use some help resolving this issue. Thanks!

**Since we're not allowed to post external links within the forum, I had to substitute (email) for the text that actually exists in the get URL section following the mailto: function.
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23473
  • Loc: Woodbridge VA

Post 3+ Months Ago

That's the same thing that gmoeller54 had showing up in his. That's not supposed to exist if you have HTML turned off in the text fields.

In his case it was disabled and still that was happening and I have no clue why. In your case, check your text fields and make sure you don't have HTML turned on.
  • palmershire
  • Born
  • Born
  • palmershire
  • Posts: 2

Post 3+ Months Ago

After checking the HTML settings, what I found is that if I changed Flash 8 to Flash 7 with AS 2.0 as the settings, the email was able to send correctly.

Issue Resolved. :iconthumbright:

Thanks for your time.
  • zicmu
  • Newbie
  • Newbie
  • zicmu
  • Posts: 7

Post 3+ Months Ago

ATNO/TW . . . Greetings ! I've been reading all your post . And I think sending an email directly with flash is very good than sending through Microsoft Outlook. It saves time. I've been trying to make your code work. But it seems that it don't even send anything to my email. I want to make some contact form in my sites. I'm using swishmax 2. and i've been uploading your files with the same sites. But yet still the same output. I would like to ask for some tutorials on how to make a flash email sender works and where/how to upload. Sorry for me being noob. Anything from you will really be a good help for a newbie like me. THANKS IN ADVANCE SIR!
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23473
  • Loc: Woodbridge VA

Post 3+ Months Ago

There are a variety of ways to do it. Try this google search There are a lot of good links there that can help you.
  • zicmu
  • Newbie
  • Newbie
  • zicmu
  • Posts: 7

Post 3+ Months Ago

Thanks Atno! I've already tried several ways of doing a EMAIL in FLASH FORM ... but i've always end up in the same place. Nothing happend with my flash form. and my emails didnt receive any emails from my site... Is it the site where i've upload my Files? If its ok if you can give me instructions and where can i upload my files. I REALLY APPRECIATED YOUR HELP! THANKS IN ADVANCE!
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23473
  • Loc: Woodbridge VA

Post 3+ Months Ago

It could be the server. Do they support php mail? If not, it won't work using php. If so you might want to post your action script and your php script for us to look at for errors.
  • zicmu
  • Newbie
  • Newbie
  • zicmu
  • Posts: 7

Post 3+ Months Ago

//>This What i have in my Send Button <//
on (release) {
if ((nameVar=="")||(emailVar=="")) {
errormessage="Please fill name and email fields";
} else {
errormessage="Sending....";
send="yes";
this.loadVariables("contact.php",'POST');
nameVar="";
emailVar="";
subjectVar="";
msgVar="";
}
}

//>And this is what i have inside my contact.php file <//
<?
if ($send=="yes") {
$sendTo = "myemail"; //>as for my email<//
if ($subjectVar=="") { $subject="Contact from Website"; } else { $subject="$subjectVar"; }
$body = "$msgVar";
$headers = "From: " . $nameVar;
$headers .= "<" . $emailVar . ">\r\n";
$headers .= "Reply-To: " . $emailVar;
mail($sendTo, $subject, $body, $headers);
}
echo "&errormessage=Email has been sent&";
?>

I've uploaded my files in freewebs. If you have other free website aside in what i've said please let me know. ^^,

That's all i have in my email form. Thanks for the help Sir ATNO. I'm still hoping that I can send this email to my mail.
>>>by the way I'm using SwishMax 2 as my Flash Creator.
Many Thanks Sir ATNO . . . More Power to you and this Site!
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23473
  • Loc: Woodbridge VA

Post 3+ Months Ago

As best I can tell from this page if you are using the free service there, then programming languages are not supported. That would be at least one reason why your mail isn't working.

I don't use free hosting services so I have none to recommend.
  • zicmu
  • Newbie
  • Newbie
  • zicmu
  • Posts: 7

Post 3+ Months Ago

How bout the codes? Is that right? Paying sites is no big deal. Just wondering if this will work. Thanks Sir ATNO!
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23473
  • Loc: Woodbridge VA

Post 3+ Months Ago

The code looks OK to me. I didn't see anything that jumped out as being wrong. But whatever you get for a host has to support php and php mail for it to work.

Even with freewebs premium services there doesn't seem to be a clear indication if php and php mail is supported, so if that's what you're considering check with their support first.
  • zicmu
  • Newbie
  • Newbie
  • zicmu
  • Posts: 7

Post 3+ Months Ago

Sir ATNO . . . Do you have any recommended PHP and PHP Mail Supported Hosting sites?. I'm really not familiar with any of the hosting sites. If you have one, please let me know. I'll try it too! Thanks SIR ATNO!
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23473
  • Loc: Woodbridge VA

Post 3+ Months Ago

Sorry it took so long to see your question. I've been away from OZZU for a few days.

I can only recommend one, and it's the one I use. The owner of OZZU, Bigwebmaster has hosting available. Read this link for more information

I would suggest sending him a PM or contacting him through the contact form.
contact.php
  • zicmu
  • Newbie
  • Newbie
  • zicmu
  • Posts: 7

Post 3+ Months Ago

SIR ATNO . . . I WANT TO APPLY WITH THIS OZZU WEBHOSTING. BUT I DONT KNOW WHERE . AND SIR ATNO . . . IF IT'S OK . . . BEFORE I'D APPLIED TO OZZU. I WANT TO KNOW HOW CAN I ACTIVATE THE EMAIL SENDING. WHERE WOULD I UPLOAD THE PHP FILES. JUST LITTLE HINTS TO GET ME STARTED. BECAUSE WHAT IF IVE APPLIED AND STILL I DONT KNOW. MAYBE THIS SITE WONT HELP ME AT ALL. THANKS SIR ATNO! MORE POWER!
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23473
  • Loc: Woodbridge VA

Post 3+ Months Ago

As far as applying for hosting, you do what I said in my last post and contact Bigwebmaster, either by sending him a private message or using the contact link.
ATNO/TW wrote:
The owner of OZZU, Bigwebmaster has hosting available. Read this link for more information

I would suggest sending him a PM or contacting him through the contact form.
contact.php


As far as uploading files, you would upload the php file into the same directory as your flash file, which in most cases I would assume to be the root.

You don't have to do anything to turn on PHP mail. It's part of the service. The script in the php file that you already have should work.
  • zicmu
  • Newbie
  • Newbie
  • zicmu
  • Posts: 7

Post 3+ Months Ago

Thanks Sir ATNO. I've already contacted Bigwebmaster. Thanks a lot Sir! You have been a really big help to me. Thanks again!
  • pansylea
  • Born
  • Born
  • pansylea
  • Posts: 1

Post 3+ Months Ago

Sorry for resurrecting an old thread but can't get my flash/php contact form working.

Action Script:
Code: [ Select ]
var checkFormAndSend = function () {
    clearInterval(__root.intervalResponse);
    __root.contact_clip.response_label._alpha = 0;
    if ((((__root.contact_clip.contact_form.input0.text != __root.formLabels[0]) && (__root.contact_clip.contact_form.input1.text != __root.formLabels[1])) && (validateEmail(__root.contact_clip.contact_form.input1.text))) && (__root.contact_clip.contact_form.input2.text != __root.formLabels[2])) {
      var _local1 = 0;
      while (_local1 < __root.formLabels.length) {
        __root.contact_clip.contact_form["input" + _local1].text = __root.formLabels[_local1];
        _local1++;
      }
      __root.showResponse("THANKS");
      return(undefined);
      var mailVars = new LoadVars();
      mailVars.fullname = __root.contact_clip.contact_form.input0.text;
      mailVars.email = __root.contact_clip.contact_form.input1.text;
      mailVars.body = __root.contact_clip.contact_form.input2.text;
      mailVars.form_admin_email = __root.contactAdminEmail;
      mailVars.onLoad = function (success) {
        if (success) {
          if (mailVars.operationResult == "OK") {
            var _local1 = 0;
            while (_local1 < __root.formLabels.length) {
              __root.contact_clip.contact_form["input" + _local1].text = __root.formLabels[_local1];
              _local1++;
            }
            __root.showResponse("THANKS");
          } else {
            __root.showResponse("SORRY ... TRY AGAIN");
          }
        } else {
          __root.showResponse("SORRY ... TRY AGAIN");
        }
      };
      mailVars.sendAndLoad("sendMail.php", mailVars, "POST");
  1. var checkFormAndSend = function () {
  2.     clearInterval(__root.intervalResponse);
  3.     __root.contact_clip.response_label._alpha = 0;
  4.     if ((((__root.contact_clip.contact_form.input0.text != __root.formLabels[0]) && (__root.contact_clip.contact_form.input1.text != __root.formLabels[1])) && (validateEmail(__root.contact_clip.contact_form.input1.text))) && (__root.contact_clip.contact_form.input2.text != __root.formLabels[2])) {
  5.       var _local1 = 0;
  6.       while (_local1 < __root.formLabels.length) {
  7.         __root.contact_clip.contact_form["input" + _local1].text = __root.formLabels[_local1];
  8.         _local1++;
  9.       }
  10.       __root.showResponse("THANKS");
  11.       return(undefined);
  12.       var mailVars = new LoadVars();
  13.       mailVars.fullname = __root.contact_clip.contact_form.input0.text;
  14.       mailVars.email = __root.contact_clip.contact_form.input1.text;
  15.       mailVars.body = __root.contact_clip.contact_form.input2.text;
  16.       mailVars.form_admin_email = __root.contactAdminEmail;
  17.       mailVars.onLoad = function (success) {
  18.         if (success) {
  19.           if (mailVars.operationResult == "OK") {
  20.             var _local1 = 0;
  21.             while (_local1 < __root.formLabels.length) {
  22.               __root.contact_clip.contact_form["input" + _local1].text = __root.formLabels[_local1];
  23.               _local1++;
  24.             }
  25.             __root.showResponse("THANKS");
  26.           } else {
  27.             __root.showResponse("SORRY ... TRY AGAIN");
  28.           }
  29.         } else {
  30.           __root.showResponse("SORRY ... TRY AGAIN");
  31.         }
  32.       };
  33.       mailVars.sendAndLoad("sendMail.php", mailVars, "POST");


PHP code:
Code: [ Select ]
<?
$fullname = $_POST['fullname'];
$email = $_POST['email'];
$body = $_POST['body'];

// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\n";
// Additional headers
$headers .= 'To: <myemailaddress>' . "\n";
$headers .= 'From: <senderemailaddress>' . "\n";

$recipient = "myemailaddress";
$subject = "Contact Form Query";

$msg = $fullname . $email . $body;

mail($recipient, $subject ,$msg, $headers);

?>
  1. <?
  2. $fullname = $_POST['fullname'];
  3. $email = $_POST['email'];
  4. $body = $_POST['body'];
  5. // To send HTML mail, the Content-type header must be set
  6. $headers = 'MIME-Version: 1.0' . "\n";
  7. $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\n";
  8. // Additional headers
  9. $headers .= 'To: <myemailaddress>' . "\n";
  10. $headers .= 'From: <senderemailaddress>' . "\n";
  11. $recipient = "myemailaddress";
  12. $subject = "Contact Form Query";
  13. $msg = $fullname . $email . $body;
  14. mail($recipient, $subject ,$msg, $headers);
  15. ?>


When i try and send an email from the contact form it will not email anything, but if i type in the url to the sendMail.php, i get the email but without the entered information (obviously cause i haven't entered them).

Any advice would be a great help. Am at a standstill.

Thank you

Post Information

  • Total Posts in this topic: 59 posts
  • Users browsing this forum: No registered users and 7 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
 
cron
 

© 1998-2016. Ozzu® is a registered trademark of Unmelted, LLC.