There are only a few steps for sending mails through Flash and PHP.
First thing is of course to design an interface using that you will be for sending mails, and the second portion is the PHP code. So we will start with the first portion to make an interface and attach Variables with input boxes.
Flash part
We will add four input boxes for
ToFrom
Subject
Body
Follow the steps
1. Pick up the text Tool and write To, From, Subject, Body in a static form. Choose Static from text box properties like this
2. Now make another text box using text Tool and set its properties as input box, like this
and place it in front of text To, so it will look like this
3. Now we have to attach a variable with this input box. For that we will click on the input box and in its Properties tab we will input the variable name. See the RED rounded rectangle area. The variable we will is to.
4. Now COPY and PASTE this input box and place in front ofFrom, Subject and Body so it will look like this
Now select the BODY input box and change its variable name and also from single line to multiple line.
5. Now you will have to change the variables names of each input Boxes. Click on the input box which is in front of From and in its properties change its variable name to from. Now click on the input box in front of Subject and change its variable name to subject. Click in Body input box and change its variable name to body.
6. Now make a button "send" and in its action put the following code.
| on (release) {
if (to eq "" || from eq"" || subject eq "" || body eq "") { getURL("javascript:alert("All fields are required");"); } else { send = "done"; loadVariablesNum("mail.php", 0, "POST"); getURL("javascript:alert("Your mail has been successfully sent");"); to=""; from=""; subject=""; body=""; } |
7. Now we have to make a check either all the input boxes are filled or not, for that right click on the first frame of the Layer one and click on Action.
in its action panel paste the following code.
| stop();
to=""; from=""; subject=""; body=""; |
Finally the mail form will look like this.
All Flash work is done. Now we have to make our PHP code.
PHP part
Now we have to integrate the variables we have made in Flash with PHP script.
Follow the steps
1. Open Notepade or any text Editor you like.
2. Paste the following code into that
| if ($send=="done") {
$to = escapeshellcmd($to); $subject = escapeshellcmd($subject); $body = escapeshellcmd($body); $from = escapeshellcmd($from); $tfrom = "From: <$from>"; mail($to,$subject,$body,$tfrom); } ?> |
3. Save this file with name mail.php
That's all done.
Now you have to find any web server that's supports PHP scripts, so that you can test you Email Sender program. Upload your HTML, SWF and PHP file
in the same folder. Hope it helps.
Regards
Ali Roman.
Download example files here.

Hajime January 23, 2007 says:Well, it doesnt't work. I wonder what i did wrong. I thought that my flash was wrong and I used a flash from an example file. It didn't work either. the flash form can be found here. The php (in txt file) u can prewiev here. Can anyone help me with that?



