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




Change the font for the text in the form to get it to work. The current font it has doesn’t work with speical characters like @ sign.
Hope this helps someone.
“leaseillualltetields” appears when I click the send button without any text input. Can it be changed to “Error” or is there any problem?
And it says Error opening URL ‘file:///C|/Users/mich/Desktop/web/send_email.php?flashmo=388′
when all fields are filled when I click the send button
I saw the previous reply for Ed but I still cant figure out how to solve this..
I haven’t uploaded my website yet so all i have now is my website fla and the send_email.php
Someone please help!!
Thanks in advance!
Good information. A Flash form looks better and works better.
This works fine brilliant but how can I stop the auto reply messages going into peoples spam!
Ive been reading that you need messages headers… How can this be done simply and easily?
Would be of great help, thanks
For everyone who are struggeling with having the message sent:
I had problems sending the message and I tried a lot of things and spent a lot of time trying to find the bug to solve the problem.
Anyway, easy way out of it was to break apart the whole movieclip and write the command script straight to the scene where the movieclip was. Then the text fields and all the graphics can be grouped as graphic.
If you want the contact form to appear in different scenes, you must get the graphic from the library and the copy-paste the frames that include script to the new scene.
Hopefully this will help…
For 086 speaker template, where’s contact change? How can I change e-mail address in it? I use Adobe Flash CS5
Everything works great, but how can I change the appearance of them I receive.
This is what the subject line looks like:
Fancy Contact Form – george
email body:
Name: george
Email: georgesawyer3@gmail.com
Subject: austin
Message: adfdw
I
To correct the previous post, the email is not formatted, but instead reads ”
“Name: andrew
Email: pogue.andrew@gmail.com
Subject: austin
Message: adfdw”
How can I change it where it formats the email instead of displaying the actual tags (FONT FACE, KERNING< SIZE, etc)?
george, you may need to edit send_email.php file. If you want to do HTML formatting, you may learn more about HTML email.
The only thing I changed in send_email.php was the address. How would I edit the send_email.php so that it doesn’t send it formatted?
@david…i am struggling to get the form to work. are you refering to the php font or the input text field font. what should one change it to?
I just can’t get this contact form to work, tell me in the php file do i replace the flashmo to the name of my swf file? let say in place of “send_email.php?flashmo=”; to “send_email.php?myswf=”;
AND BY THE WAY PHP WORKS ON MY SERVER JUST FINE.
hello, I have problem in this form when I press send it is sending … and never leaves it. The form is on the site that I’m doing inside a movieclip. could someone help me solve this problem?
Hey there, i tried it a whole day. but only the one without autoreply works. the other one stays stuck telling me “…sending” and neither email nor autoreply-mail is sent. this is my code:
can anybody help me?
thanks so much!
oh, i can’t paste codes. here is the link to the code i’m using…
http://cl.ly/68Wg
Hello Christian,
Your code is not the original one because it has many syntax errors, especially for all double quotes ” “.
To Admin
I try my very best to get this contact form to work, but I can’t. I went as far to call up Yahoo support that’s is who my server is with and they couldn’t get it to work as well. They told me there was post problems with the send_email.php form. And my rule they are not allow to help with any kind of php form, so can you please re-check the form thanks.
Tbone,
hi Your code is not the original one because it has many syntax errors, especially for all double quotes ” “.
Okay Friends ..here is the reason to the “sending….” problem,,
if the Email gets stuck on sending and It does not send at all here is the reason …
1. Call your swf – form_123.swf
2. Open the Source File and Change the path (in the AS) – loadVariables(“send_email.php?flashmo=” + random(1000), this, “POST”); to loadVariables(“send_email.php?form” + random(1000), this, “POST”);
3. Save the swf and the send_email.php in the same Folder like your index.html (your website).
4. Open the send_email.php and change in the line 10 $receiver = “your@email.com”; your email.
Thats it Now it works !!
Greets
Nardo @ f-mediendesign.de
Hi and thank you for sharing with us this contact form. I need to use it in my website but I had problems when i’ve tried to configure it because i don’t have Flash knowledge. These days I found here:http://www.flashxml.net/contact-form.html an awesome contact form which can be customized live and is more simply to use. Maybe you will implement something similar in the future, would be awesome.
Hi,
My form works with the html link once uploded to my server, however when I insert the SWF into a webpage and upload it it just says sending… I have tried the fix above on the 28th JUNE with no difference. Can you help as this form is excellent otherwise..
Thanks
Richard
Just wanna say … thank you … for this tutorial
It’s working fine on my server. I wonder whether we can extend this so that can send attachment file as well … thanks
Hello. Form is working fine.
But I´m getting some strange status messages. Instead of “sending”, “message sendt” and so on, I get some strange words tyhat doesn´t meen anything. Checked out the actionscript and the right messages are there…
Please help
Fixed it by setting the text fields to “device Font”….
Strike that… Still the same problem after publishing to server. Messages only work when opening the swf localy…
OK… fixed it by changing the charset=utf-8 to charset=utf-16 in the html file.
Hello again. I have been able to make this work with scandinavian characters using UTF8 Like this:
$contact_name = utf8_decode($HTTP_POST_VARS['name']);
$contact_email = $_POST['email'];
$contact_subject = utf8_decode($HTTP_POST_VARS['subject']);
$contact_message = utf8_decode($HTTP_POST_VARS['message']);
Mail is sendt with the correct characters.
But now the form gets stuck on “sending”. Can you please help me with this?
Sincerely
Ronny
Hello, by chance I solved the sending… problem. It definitely depends on the quotes. When I copied the code from this site the quotes (” and ‘) were different to the quotes in the downloadable zip file. I replaced all of them and everything worked fine. Even when using the contact form in my website. Hope this will help someone.
Sincerely
Michaela
Works fine, I just dont like the booooooring text on the right. Can you provide a cleaner form or maybe an FLA file we can edit?