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




I like to have ” 2 reciever ” in a message,like
reciever1: email1yahoo.com
reciever2: email2yahoo.com
How to do this? Explane pls?
Hi there I have my mailform.php on a php enabled server which is different from where the website is served the served site server is not php, does both servers need to have php? another quick question would you need swf address to make flash contact forms work?
i’m testing this locally, not on a site. i’m using WAMPserver. i’m a senior in high school and i get most of this code, but when i put it in my server and run the html from my server it works, up until i click send, it says “sending” then says message could not send. i dont understand why it’s saying that… why isnt the message going through? i changed the $recipient in the php file to my email, but it doesnt go through. how can i fix this? i typed everything into the form correctly.
also there are a few bugs with this form. after i get the error that says cant be sent, if i delete anything, the message for example, then hit send, it displays “please insert all feilds” or “insert valid emial” depending on what i erased, for not even a secon. how can i make these longer so it isnt glitchy? or just make it stay at “insert all fields/valid email” without switching back to “cannot send”
hopefully you understand what i’m saying… it’s hard to explain.
great form and it works!! but what if I want to add a checkbox?
Thanks.
The autoresponder doesn´t work
I have downloaded the AS2 form an got it working successfully. I now want to add a number of extra Data Fields to it and they don’t seem to work in the PHP side.
The new input field is labeled ‘contact_more’ in the flash file and it all works ok but when I send it the new field is blank on the email recieved.
I have tried the following in the PHP but it doesn’t seem to want to input the text frome ‘Contact_more’. I was hoping for a solution to fix this:
Apologies.
Just goes to show you don’t need a long neck to be a goose.
I forgot to set the new field with a Variable’ name – d’oh.
All fixed. Sorry to trouble you.
Hi there, I followed the instruction, every thing is working fine, just when I try to send it gives me this massage:Error opening URL ‘file:///Macintosh%20HD/Users/edwardnahapetian/Desktop/Paros%20web%20site/send_email.php?flashmo=459′
Would you help me with this please, I do not know what to do.
Thanks Ed.
Thank you this worked a treat and I even modified it to fit the rest of the site – you are a life saver. Saved me heaps of work
THANK YOU SO MUCH FOR THIS !!! This form is amazing..it works perfect and this ended my 1,5 year search for a good but simple form.
thx again !!
reply to:
Ed Nahapetian says:
28 January 2010 at 4:36 am
Hi there, I followed the instruction, every thing is working fine, just when I try to send it gives me this massage:Error opening URL ‘file:///Macintosh%20HD/Users/edwardnahapetian/Desktop/Paros%20web%20site/send_email.php?flashmo=459?
Would you help me with this please, I do not know what to do.
Thanks Ed.
…………
you need to change the that path in your html file to the path it is on the server as
how can i get this to work with cfmmail using coldfusion.
Email me at gc_extreme@hotmail.com
Hi Ed,
when i send the contact form, it just says sending….
but no mail send. Do i need to set any smtp server name in the sendmail.php or somewhere. Pls help
hello, when clicking the send button, it says “your message could not be sent. please try again.” why is this? before it used to just sit at the “sending…” process, but i put all files in the same folder as the html page and now it’s saying the message could not be sent quote. PLEASE HELP!
Hi.. hope somebody can help me :S
I did all the steps, but when i try to send an email from the website (form) , stays in sending….
what can be wrong?
Please help.. Thanks
I fixed the problem!
A lot of people are hosted at GoDaddy, but these scripts don’t work there.
I’m hosted at http://www.deleonhosting.com and they work perfectly!
I am recieving all the e-mails people send to me. To see what it looks like, click on the following link.
http://img94.imageshack.us/img94/1632/screenshotml.jpg
Best regards,
Ivar
Hello, my form is working but Turkish characters are receiving incorrect from swf form,
Name: Ä?Ä?Ä?Ä?Ä?Ä?Ä?Ä?Ä?
Email: CC@CC.COM
Subject: Ä?Ä?Ä?Ä?Ä?Ä?Ä?Ä?Ä?Ä?Ä?Ä?Ä?Ä?
Message: Ä?Ä?Ä?Ä?Ä?Ä?Ä?Ä?Ä?Ä?Ä?Ä?Ä?Ä?Ä?Ä?Ä?Ä?
mail receiving like this,
can you help me
Engin
I used a similar email contact form, but it have a clean and nice look, here is the link:
http://www.gotelement.com/home/flash-scripts/141-flash-email-contact-form-as2.html
After days of troubleshooting, I finally realized the reason the form got stuck on “sending” was because I was using a preloaded to load the swf file. When I removed the preloader, the form works perfectly. My question if anyone has encountered this, is how can I use this form and still used my preloaded program? Could it just be changing the as in the fla to reflect this? or am I stuck building my own preloader.
I use SWF Lock & Load to load my flashsite.swf inside an html file.
Any thoughts?
Hi Rachel,
I’m struggling with exactly the same problem. Have you had any luck?
Thanks
Ardeaus,
I built a simple preloader at the beginning of my fla file and the form worked seamlessly. The problem definitely was having the external preloader load the fla file containing the form. Once I realized this I didn’t investigate why this is. Hope this helps.
http://www.vignettesphotography.com is the site I built and created my own preloader for, not as fancy as what SWF Load and Load can do, but it does the job and the form works.
Hello!,
when i send the contact form, it just says sending….
but no mail send. Do i need to set any smtp server name in the sendmail.php or somewhere.
Pleases can you help me!
Many thanks
The form is not working… Can anyone tell me if this problem is related to the SMTP authentication that does not exist?
Can anyone help me?
Thanks in advance!!!
Pedro
when i send the contact form, it just says sending….
but no mail send. Do i need to set any smtp server name in the sendmail.php or somewhere. Pls help
Hello, I’m getting everything people send me but the form never saids “your message have been sent” it gets stuck on “sending…”
I built my own preloader, so that’s not the problem.
Any solution?
Thank you.
Hello again!
I found the solution to the problem of the text being stuck on “sending…”. Go to the .fla file, and on the “send” frame change the following:
if( success == “yes” ) to: if( “success = yes” )
and:
else if( success == “no” ) to: else if( “success = no” )
And voila! It works
Hope this helps.
I get the form to work. ALMOST. after hitting the send button I still have not received any of my test emails. Im hosting on godaddy.
Take a look at the site http://hudsonsauce.com/beta.html
im using an email hosted on godaddy. I have tried using my yahoo email but still no delivery.
Form doesn’t work for me. It says “Your message could not be sent. Please try again.” I changed the $receiver, copied swf, html and php in the same location but what am i missing? PLEASE HELP! Also, host of my site supports PHP and the receiver mail is hotmail: check it http://quintero.awardspace.biz
Admin can u answer me pls
I’ve used this contact form for over a year and had no problem; but recently have had the problem where some characters will not type in the fields so leaving it pretty useless as a contact form. Anybody have this problem or know how to fix it? Thanks
admin – I would like to add a Yes/No check box to the form. Would you be able to post the code or direct me to a tutorial that could accomplish this? Thank you in advance!
I downloaded a beautifull template. But couldt make the contact form work…
Thankyou so much!!!
Hi! great stuff. But can you give me a tip? I need the same you worked of BUT I need to add a radio button and don´t have an idea on how to do it, can you pls help me?
TNX!!!
hi
pls, pls plsss help me, have downloaded a flash template estate_221 but the contact form doesnt allow me to use SHIFT key, i cant enter @ sign.
can you tell me how can i fix it plss?
my website is http://www.poonamvdabur.com – its still under development. i need this contact form pls? help me?
thanks
richard skins , i hv exactly same prob… pls tell me if u found any solution?
OK LADIES AND GENTS, after a few days of tinkering around, I found a solution for those of you who are using GoDaddy.com as your host. As mentioned earlier in a post, the only real way you’re going to get your contact form to work properly (without having to resort to another language)on their servers is to convert your Windows based server to Linux. From what I can tell, their Linux servers support both PHP4 and PHP5 (as per their help section notes) whereas the Windows based servers support IIS 7, which only supports PHP5 (NOT PHP4). Now, I’m not that adept when it comes to programming in PHP but it seems as though the scripting for this form is in PHP4 syntax? (anyone confirm this?)
I originally purchased a economy hosting package for Windows and uploaded my 4 files into the root directory:
- index.html
- send_email.php (I used the ’send_email_auto_response.php’, renamed)
- website.swf
- swfobject.js
The website worked great but the contact form did the infamous “Failed…” line. So, just on a whim, I looked around for hours, trying to find an answer as to why people have had so much success while others (like us here) are getting errors. I found a help message on GoDaddy’s site that pointed that IIS 7 supports PHP5 but not PHP4… and it clicked. Maybe, since this form is a year+ old, that it could be written in PHP4 syntax and not PHP5, hence not allowing the script to work properly? I did some more digging and found that their Linux server has hosted files made specifically for PHP Mailers.. so if theirs work, why can’t the PHP file from this form do the same?
I logged into the control panel and changed my plan from Windows to Linux based server (which was free) but it took about 6 or so hours for the operating system to be converted for my domain.
Finally, it came back up. I immediately uploaded my files and sure enough…. “Success! Your message was sent.” popped up in red.
Linux made all the difference in making this form work properly. As I said before, I’m no expert to PHP code, but perhaps the compatibility to PHP4 made things run just they way they’re supposed to.
Sorry for the long post, but I hope this helps those of you who are still have problems. BTW, I use flashmo_191_mini_orange. Only thing I changed were some grammatical errors in the AS3 scripting for when a field was left blank or improperly formatted (i.e. email syntax) and the email address on the send_email.php as stated in red on the top of this page.
Good luck!
Ben
in the flash template number 92
i did not receive a .php file
where can i change the receiver for the e-mail?
Hi just have some problem everything seems find im gettin msg sending and message send succesfuly but dont bet any mail in
server is one.com so its php on
what could be the problem?
the contact form doesnt even let me put some letters like q z x even @ for mail.. ?
Nak, I guess you need to do “Character Embedding” for all textfields.
Great form…but how does it work for SMTP-AUTH? I’m not a programmer…is there an easy modification to the php code someone can adjust and send me?
By the way, it doesn’t work on my site…one can fill out the form and send, then it says it sends but it doesn’t send me anything. My provider says its because of the SMTP-AUTH…please help.
Any Luck with getting the mail? this is where i am stuck at the moment. I use Justhost.
I have the problem to insert “@” character and more in mail section in contact form. I use flashmo_219_mash templete. Please help me. Tanks
everythings were done..but i still can’t to received any email send from contact form…Please help me to solve it…
got ppl help me to solve my problem…i really urgent for it..
Do I need to put the PHP into my web directory before this will work? What directory should I put it into? It’s not working yet.
But it looks great.
hi guys,
i got template 86_speaker and got following action script in the movie “flashmo contents”:
———————————————————-
reset_button.onRelease = function()
{
contact_name.text = “”;
contact_email.text = “”;
contact_subject.text = “”;
contact_message.text = “”;
}
send_button.onRelease = function()
{
if( contact_name.text != “” && contact_email.text != “” &&
contact_subject.text != “” && contact_message.text != “” )
{
// here you send contact variables to a server-side page
// getURL(“http://www.xxx.com”);
contact_name.text = “”;
contact_email.text = “”;
contact_subject.text = “”;
contact_message.text = “Thank You! Your message was sent successfully!”;
}
}
———————————————————
How do i change it to use send_email.php?
The AS says
// here you send contact variables to a server-side page
With loadVariables(“send_email.php” + random(1000), this, “POST”);?
Btw my server supports php.
Please help me and apologize my bad english!
Hi, please I follow all the previous replies and made changes likes “success == yes” indeed “yes” and the form show the message in red that it was successfull sent, but i dont have any mail from the form. I have godaddy Linux server but any of your solutions could give me any help. Someone has a tip for this?
how about the saving of images to php?…
can you help me!…
thank u