- Home
- Tutorials
- Flash
- Intermediate
- Send Email via Flash and PHP

Conclusion
Jesse Stratford
Jesse lives and works in Melbourne Australia. He is the Cofounder of http://ActionScript.org. A Flash enthusiast, teacher, author, freelancer and speaker Jesse's main focus nowadays is managing http://ActionScript.org, but he enjoys participating actively in community and the wider Flash scene when he has time.
View all articles by Jesse StratfordThe POST method is a form of communicate between files. Many of you would be familiar with the GET method which appends data tot he URL call of a file, (file.swf?variable=value). POST also communicates variables, however these variables are sent using hypertext protocol and not in the URL call. This is useful when the data you wish to submit is confidential (you don't want someone's password showing up in the URL!) or if your variables contain data that may cause errors. In this case, we cannot use GET because Flash reads the " " characters before sending off the call and subsequently tries to call a URL with multiple lines, (which obviously won't work).
That's it! Now you can upload both files to a web-server with PHP support and you should have no trouble getting it to work. These files do not require special permission to run and mail() is enabled on all half-decent PHP hosts. Remember that you can't run these files on your local disk unless you are running some sort of web-server with a PHP interpreter.
Thanks to Shai-Tan and massd on Efnet for their help with figuring out alternative ways to pass the damn new line markers!
| Jesse Stratford is the Co-Master of ActionScript.org and a freelance Flash developer and teacher. He is based in Australia and enjoys all things Flash. NB: If you have comments or feedback please feel free to email me, but please do not email me Flash questions; the forums are provided for that purpose and you will get a faster answer by posting you question there. |
If you have found this tutorial helpful, I hope that you will take 30 seconds to visit The Hunger Site where, with just one click you can make a free donation of food to a starving person in a third-world country. We do not benefit financially from this action; it is purely an act of charity. |
| This tutorial is protected by International Intellectual Property Rights laws and may not be reproduced or redistributed in full or part, without the prior written consent of the author. Unauthorized reproduction of this tutorial or its contents may result in prosecution. I've worked hard on this tutorial, please don't steal it. |
Spread The Word
13 Responses to "Send Email via Flash and PHP" 
|
said this on 07 Mar 2007 1:04:52 PM CST
I tried but not working on geocities
|
|
said this on 11 May 2007 3:31:36 PM CST
Yeh I can't get it to work either. Changed the email address in PHP file and I replaced the "add" on line 7 of frame one by highlighting the "add" and selecting it from the list. It looks the same?? Maybe this is where I've gone wrong. Can someone help?(not 2 only found stop command there)
|
|
said this on 01 Jun 2007 3:27:23 PM CST
For what I know, free geocities does not have php support.
Also I want to know how to redirect to another page after the mail is sended Thanks |
|
said this on 12 Jun 2007 11:24:49 AM CST
Hi
Why it send me an empty email? why? |
|
said this on 30 Jun 2007 6:15:38 AM CST
Of course I stumble across this article *AFTER* I get it working. Although, a bit of appreciation is due. I am NOT a Flash guy and have been pulling my hair out trying to get the email working amongst an array of other problems. The original FLA used the getURL() method, which produced a hideous new browser window. Digging around, I came across the loadVariablesNum() method. Reading the help docs, it seemed reasonable that this would give me the results I wanted.
And I am here to confirm, that it indeed does. Worked like a charm, and Jesse's article removed any suspicion I had that the method I used was inappropriate. Oh, and for the record, this works just as well with an ASP (mailer) script. Jesse, might I suggest updating this document by adding a generic ASP handler in addition to the PHP ones. |
|
said this on 01 Jul 2007 6:41:02 PM CST
I found this tutorial extremely helpful, but I'm still unable to get the form to work within my flash site. I even tried making the form its own page and not even on my flash file and it still didn't work.
My website is through Yahoo and my FTP is Vicomsoft. I don't know what to do. If anyone could help it would be great!!! Just email me at lapointe2041@yahoo.com |
|
said this on 06 Jul 2007 12:58:09 PM CST
it seems to work for me so far, but it still sends even if there is nothing in the fields..anyone know how to fix this? i tried changing the or's in the send buttons actions to || but it still sends blank emails..? thanks
|
|
said this on 23 Jul 2007 7:40:02 AM CST
I cant get it to send me the info, it sends me blank e-mails, Can Anyone Help?
|
|
said this on 14 Aug 2007 3:26:13 PM CST
I'm using flash 8 and it won't seem to work for me. I've triple checked my work and find the instructions very clear and simple to understand. It seems like most people have had an issue with this method. I did get rid of the message input and Var is that why it doesn't work? cchown@gmail.com
|
|
said this on 24 Aug 2007 5:35:22 PM CST
For those having trouble with the verification section of the action script, I first defined the variables at the top of the actionscript on frame one like:
message = ""; subject = ""; from = ""; and then changed the if statement on the send button from: if (subject eq "" or message eq "" or from eq "") to: if (subject == "" || message == "" || from == "") This solved the trouble. There are several good actionscript examples of field validation out there, and I suggest once you have this working, you dig some up and look at validating the email address. |
|
said this on 03 Oct 2007 1:07:53 AM CST
Wow, this is fantastic... I was kinda hooked up with loadvariable syntax, and it helped me a lot... Thanks a lot ma man ...
|
|
said this on 21 Oct 2007 3:24:58 AM CST
Thank you for taking your time to share your knowledge.
It didn't work for me though. I did however find another script that did work for me. http://www.kirupa.com/developer/actionscript/flash_php_email.htm |
|
said this on 18 Feb 2008 8:57:53 PM CST
Great Tutorial thanks - watch out though the php may be vulnerable to hacking by spammers without validation
|




Author/Admin)