AS2 Flash Contact Form
Here is a working example of flash contact form with simple validations using ActionScript 2 and PHP mail function. This flash email form can also immediately response back to you if the email was sent successfully or failed. You can easily copy the contact form movie clip and paste it into an empty frame of any flash template.
You need to replace below red line with your email address in send_email.php file.
$receiver = “youremail@yourdomain.com”;
If your web server does not support PHP, you will need to use any other supported server side language for mail function instead of using send_email.php file.
UPDATES (24 June 2008): Adding Email Auto Response in send_email.php file
-
<?php
-
$contact_name = $_POST[‘name’];
-
$contact_email = $_POST[‘email’];
-
$contact_subject = $_POST[’subject’];
-
$contact_message = $_POST[‘message’];
-
-
if( $contact_name == true )
-
{
-
$sender = $contact_email;
-
$receiver = “youremail@yourdomain.com”;
-
$client_ip = $_SERVER[‘REMOTE_ADDR’];
-
-
$email_body = “Name: $contact_name \nEmail: $sender \nSubject: $contact_subject \nMessage: $contact_message \nIP: $client_ip \nFlash Contact Form provided by http://www.flashmo.com”;
-
$email_body_auto_reply = “Hello $contact_name, \nThis is the auto reply message. Thank you. \nAdmin – http://www.flashmo.com”;
-
-
$extra_auto_reply = “From: $receiver\r\n“ . “Reply-To: $receiver \r\n“ . “X-Mailer: PHP/” . phpversion();
-
-
mail( $sender, “Auto Reply – Re: $subject”, $email_body_auto_reply, $extra_auto_reply ); // auto reply mail to sender
-
-
{
-
echo “success=yes”;
-
}
-
else
-
{
-
echo “success=no”;
-
}
-
}
-
?>
UPDATES (22 July 2008): Error correction in send_email.php file
Please change $subject to $contact_subject in line number 15.
Feel free to drop a comment if you have any question or feedback.
Related Post: Flash Contact Form in ActionScript 3





Hi
Can you please help me figure out how this wud work? i did follow up all the instructions
changed the recive email address to mine in send php
when i upload the form to the server the form looks fine but when i fill in the form and click send it get stuck on “sending…” nothing happens after that. ” i am using my yahoo account address as the reciever email.
could you please guide me and explain to me how to it this form working.
hope to hear from you soon thnx
Hi Again,
just wanna to tel you i do get both messages to my emails
but when i submit the form it dosent say the message is been submit it just stays freezed on sending… and when i click few more times on the send button the sending… message dissapears but the form dosent clear out. it still stays freezed with the information typed.
could you please help me out with this. thnx
hey,
just curious… i’m currently trying to edit flash_079_classic template, and i can’t seem to edit the title, slogan, or copyright info. what do i do?
thanks, i’d appreciate a sorta fast reply
x
hi,
I’ve got a quick question. The form is working fine for me, but I’d like to change one thing. The text that appears under the form telling the user to “please provide a valid email” or “sending” is always red. This color really clashes with the color scheme on my website. How can I change it to white?
Hi,I’ve a problem.When I click the SEND button I get an error “Your message couldn’t be send.Please try again.” Please help!!!
Hi!
First -Thanks for the form!
But I have the same problem as Nesha – form does not resets after I press “send” button.
After button is pressed again – the message dissapers But all info typed – stays in the form. I dont think it is the server. I do get emails from the form. (auto respond to!)
What could it be – anyone?
Please, how to make it work on flashmo_092_restaurant template?
how can i get it to work on flashmo_081_design help please.
[...] contact form is simply made in Adobe Flash CS3 ActionScript 3. Email validation is better than previous version in ActionScript 2. It sends the form field variables to PHP and loads the response variables back to Flash using [...]
I cant download it. The “Download Source” link does nothing. Judging by other posts here, I’m not the first with this problem
Can someone re-host the zip file for this? =)
Hi, Admin.
I edited template 118 fashion gallery and upload our host but I’ve been realized sadly to our host has not .php support.
Is there any way to solve this problem by AS, JS etc. ?
hi, I cant get work this form, I uploaded all files, and change receiver for my mail adress but I cant receive the form in my mailbox, im using hotmail, but its not working, pd. Im using flashfomr for as2. please help.
gr8t all done!! thx
Greetings,
I’m not sure why admins stop giving assistance but it appears many of us are still having trouble. I accomplished everything I’ve wanted so far except putting this contact form on my existing fla. The fla is from flashmo and has an example set up but not ready to work.
So I download this, copy everything from the Library, Movie Explorer and Actions over to my fla or even a blank fla but NOTHING works.
I’ve uploaded this html, swf and email_php and it sends the e-mail fine. But I just CANNOT get it to transfer to my fla. I even created a new one and and made an exact copy of everything but still nothing.
Does anyone know if renaming the swfs and etc could effect it? I wouldn’t think so as long as the codes all pointed to the right files but I am stumped. ANY help what so ever would be appreciated. I’ve given assistance to others on this site, just hoping someone else can do the same…
Thanks
Is there any way you can make this form work from a stand-alone Flash Player .exe-file that runs from a CD or does it only work when executed on the web?
I am quite new at this, would appreciate some assistance.
Many thanks
Corey, I do not stop giving assistance. It is just that I do not get enough time to support everyone though I try to support as much as I can. I am really sorry about that.
Saber, I think it is possible by sending form fields data to Outlook or another email client for email.
hi admin!
will you answer my question up there?
Hi admin,
bigups for the wonderful works your are doing. I am trying to insert or import an intro template into a website template, all in flash , but this has not been easy. need help please
Ugur, there is no way to send email by AS or JS only. You need to have server-side mail processing scripts such as PHP, Perl, CGI, or ASP.
Hello Admin,
I would appreciate it if you assist me with the script when you say sending form details to Outlook since I am very new to flash an am learning my way round.
Appreciate your time.
Many thanks
i’m having the same problem as the one reported above. I just see ’sending..’ and nothing else happens. i changed the html page housing my swf to *.php extension. What is the possible problem?
I am needing help with a contact page submit button directly to my email address? I am not understanding the flash php dual script. I have surfed around and found that the only thing is to put “on (release) ; { get to url(myemail) } but it does not work. I know it is simple however I am extremely lost on this piece. Please help
Hi there – Any Help would be appreciated
I can’t get this contact form to work at all. It just gets stuck on “sending…†It does not send at all
It says “sending…†and does nothing then hit Send again and the form just clears.
I have changed receiver to my email address
I’ve contacted my ISP and they say that they support php however the php file must be within a folder named cgi-bin- I’ve set permissions for “send_email.php†to 755 even 777 and tried placing it inside and outside the cgi-bin and nothing works. I also believe that the server is a linux server.
On reading the forum I see users gets results when all three files html,swf & send_email.php are within the same folder. This I’ve tried and again no luck however my ISP says that all .PHP must not be on the web space server only within the cgi-bin.
I’ve have even tried changing the path loadVariables(“send_email.php?flashmo=” + random(1000), this, “POST”); to loadVariables(“http://ccgi.username.plus.com/cgi-bin/send_email.php?flashmo=” + random(1000), this, “POST”);
Done all I can and no luck at all. Please help as I’m getting annoyed and about to give up.
Thank you
Hello jolz and Roco bach,
Before you are making this flash form works, you need to make sure your web server supports PHP mail function by testing a simple mail script that sends email to your inbox. There are a lot of samples, just type “php mail” in Google and search.
Hi PHil, you cannot send the flash form data directly into your email. You need to have a server-side script such as PHP, ASP, or JSP for mail processing.
i have designed other sites running php on my laptop. I always test them and they always run. I will try to upload it online to my webhosts server and see if it runs just assuming d problem is with the php mail function
Run php mail test within cgi-bin on my server and all is working. It appears that the form has issues because the .php file is located within this cgi-bin folder even though persmissions are set to 755.
Is there anything that needs to be edited either within the action script in flash or .php file to make this form work being that the .php file is not located within the same folder as the html, swf. on our servers?
Thank you for your support
jolz, some hosting does not allow php mail function. You will need to do extra mail setup using SMTP and phpMailer for that case.
Roco bach, I am not sure about CGI-BIN because I do not know anything about it. Sorry
ADMIN – Thank you for your time and support which is gratefully appreciated.
BINGO! – I’ve managed to have this form working. It seems I had the same problem as user “BAM†being that our servers include a cgi-bin for .php files. I contacted my ISP and explained that all 3 files .html, .swf & .php must be in the root folder. They made some adjustment which was beyond my control – Whalla!
Question to “ADMIN†– My ISP explained to me after viewing the “send_email .php†script that this script is basic and open to abuse by hackers. By having such script open would jeopardise my account if subject to abuse. Could this script be updated so that it Hacker Proof?
I’m gutted – SERIOUSLY Gutted, I adore this Form, The best I’ve come across on the net, I’ve tried to get this form working for over a week and finally I’ve got it working, I’m told I run a 99.9% risk of being hacked. I’m so Hacked off.
I know nothing about PHP scripting. I wouldn’t know where to start to prevent being hacked.
Any advice or an updated hacked proof script would be much appreciated.
Again – Thank you for your support.
I’ve added this form onto my website but it only works if I change the html file to my index.html page.
I want to load this swf file into another swf file but doesn’t get passed sending… when I try it that way.
All of the files are in my root folder so the url’s should be fine.
What could be causing this problem?
Hi there. Is there any way that I can add an additional email address in the php file. so the email will go to two different emails???
And curious if there was any way..when it says message sent, can that stay on the form for alittle longer than it does???
thank you
Julie
Julie,
Yes, you can do that in PHP file the following line…
$receiver = “youremail@yourdomain.com, secondmail@yourdomain.comâ€;
You can also make it a bit longer by increasing the number of frames.
Great stuff fella thanks!
Just a quick question… how hard would it be to send an attachment stored on the server with the email? i’ve currently got a form that uploads an image to the server and takes some user input, but i want to add the image as an attachment… any ideas?
Cheers
C
I did a site for a client and he is now asking if he could recieve the email from the contact form in html format.
How do i do that. and is there a way that i can let the form send a copy of the message to the sender?
thanks
Leigh
my contact doesnt work….it say that it send it by the e mail doesnt come to my email…my server support php
Hey, nice work, but i have a issue like others, i can send mail to my Outlook mail ( info@mkayyali.com ) BUT my problem in sending a mail to Hotmail or Gmail accounts, can you help us on this ?
Thanks a lot
hey
can someone help me
I cant get it working but i dont know if my server runs php
how can i instal it ? on my server
the mailfrom is stuck at sending…
tnx
Hi Admin
this form is great and runs perfectly!!
I’m now traiing your template 086 and didn’t find the send_email.php file. Do I need this file, or where can I change the $receiver script ?
All your templates are wonderfull and the best is the assitance you give us. Thank tou verry much!
Hi. I adopted your form for use inside a flash site I’m building. Everything works fine, except I receive garbage like this in the e-mail: Name: lkhj;lkj;lkj;lkj
wait, it did not show up here: “Name: lkhj;lkj;lkj;lkj “
To be short, i get each line in the email with a string of html tags. How can I fix it?
[...] contact form is simply made in Adobe Flash CS3 ActionScript 3. Email validation is better than previous version in ActionScript 2. It sends the form field variables to PHP and loads the response variables back to Flash using [...]
hi, i am using the contact form and placing it in a preexisting fla project, however, when i test the movie or publish it, it won’t allow me to input text into any of the fields
hi there! i seem to have the same problem Kayyali has, if i submit an email adress at gmail or hotmail, an error message shows up and there’s no outgoing email, neither for the visitor nor for the webmaster… is there anyway to fix this problem?
thanx Admin for all your help!!
when trying this on my server it works great. But when i put it into my pre-existing FLA it does not. Any ideas? And yes my files are in the same location. and my server does support PHP. When i put this tutorial in a plain FLA it works, but in my site it does not.
Admin, I figured it out. Thank you for the tutorial, everything works perfectly. Was curious though if you knew how to send the user an email saying thank you and we will get back to you shortly. Or something similar.
I have attempted this and i’m having some issues. This is what i added before the closing PHP tag:
//send an auto response email to sender
if( $contact_name == true )
{
$sender = “myemail@mydomain.com”;
$receiver = $contact_email;
$email_body = “$contact_name \nThank you for your email. We will try our best to get back to you as soon as possible!\r\n\r\nSincerely,\r\nMy Name”;
$extra = “From: $sender\r\n” . “Reply-To: $sender \r\n” . “X-Mailer: PHP/” . phpversion();
if( mail( $receiver, “Wedding Site Email – $contact_subject”, $email_body, $extra ) )
{
echo “success=yes”;
}
else
{
echo “success=no”;
}
}
So this works, the only issue is that the site doesn’t say, “Your message was sent successfully!” (even though its working). Instead it gets stuck on, “Sending…”. If i delete the above if satement, everything works except the auto response. Any Ideas?
Hello- I downloaded a template that has a contact form that looks like the one above. This is my first time so if you could help me figure this out that would be awesome. I can’t seem to find a send_email.php file anywhere. I was able to edit everything else I want on the template but this has me confused. I have not uploaded the site yet. THANKS!!!
and if I want to add a telephone tag?