how to mail from flash 8 without using mailto?!

  • missy
  • Student
  • Student
  • User avatar
  • Posts: 92
  • Loc: london

Post 3+ Months Ago

well, it's been a while... I've been off getting married and lying in the sun...

Now I'm back with a stumper...

I'm using a flash website template, which has a contact page. when you fill out the email form, if you click the 'clear' button ( with this code:)
Code: [ Select ]
on (release) {
    t01 = "";
    t02 = "";
    t03 = "";
    t04 = "";
}
  1. on (release) {
  2.     t01 = "";
  3.     t02 = "";
  4.     t03 = "";
  5.     t04 = "";
  6. }

the form clears! Hooray! But the 'send' button has no code :-( Boo!

I've tried making up code, finding tutorials etc, but the only help i've found tells me how to make and script a whole form, and I can't single out the bit I need for the send button.

It may help to know that t01 is the person's name, t02 is their email address, t03 is the subject line, and t04 is the message.

I'd really like the form to work without bringing up a popup a la the mailto command.

Any ideas?!
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

send email php part
the code for you button:
either in the timeline:
Code: [ Select ]
btnSend.onPress = function()
{
  getURL("sendmail.php");
}
  1. btnSend.onPress = function()
  2. {
  3.   getURL("sendmail.php");
  4. }


or the code on the button:
Code: [ Select ]
on(press)
{
  getURL("sendmail.php");
}
  1. on(press)
  2. {
  3.   getURL("sendmail.php");
  4. }
  • classified
  • Expert
  • Expert
  • User avatar
  • Posts: 540
  • Loc: Bahrain

Post 3+ Months Ago

She can use Loadvars method as well ... search for it in google send email with loadvars , should take ya somewhere ...
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

yea, forgot the part with passing parameters.
she can either use LoadVars object or a movieclip with the desired variables (mc.t01 = "text1"; mc.t02 = "text2" ... ) then use: mc.getURL("sendmail.php");
  • missy
  • Student
  • Student
  • User avatar
  • Posts: 92
  • Loc: london

Post 3+ Months Ago

Thanks for your replies :-)

That sounds like the code I require, but where in that do I tell it where to send the mail? it needs to go to avoidanceofdoubt@gmail.com does that need to be part of the code? or somewhere else? I know... I'm being blonde again...
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

from the pic u seem red haired :P
so ... here you go .. in flash:
Code: [ Select ]
this.createEmptyMovieClip("mcForm", 0);
mcForm.mailTo = "avoidanceofdoubt@gmail.com";
mcForm.mailSubject = "test subject";
mcForm.mailFrom = "from email here"
mcForm.mailMessage = "test message";
// all of these can be loaded from dynamic texts
btnSend.onPress = function()
{
  mcForm.getURL("sendmail.php", "_blank", "POST");
}
  1. this.createEmptyMovieClip("mcForm", 0);
  2. mcForm.mailTo = "avoidanceofdoubt@gmail.com";
  3. mcForm.mailSubject = "test subject";
  4. mcForm.mailFrom = "from email here"
  5. mcForm.mailMessage = "test message";
  6. // all of these can be loaded from dynamic texts
  7. btnSend.onPress = function()
  8. {
  9.   mcForm.getURL("sendmail.php", "_blank", "POST");
  10. }

is in the php part (name it sendmail.php):
Code: [ Select ]
<?
$to = $_POST["mailTo"];
$subject = $_POST["mailSubject"];
$msg = $_POST["mailMessage"];
$from = $_POST["mailFrom"];
mail($to, $subject, $msg, $from);
?>
  1. <?
  2. $to = $_POST["mailTo"];
  3. $subject = $_POST["mailSubject"];
  4. $msg = $_POST["mailMessage"];
  5. $from = $_POST["mailFrom"];
  6. mail($to, $subject, $msg, $from);
  7. ?>
  • classified
  • Expert
  • Expert
  • User avatar
  • Posts: 540
  • Loc: Bahrain

Post 3+ Months Ago

missy wrote:
Thanks for your replies :-)

That sounds like the code I require, but where in that do I tell it where to send the mail? it needs to go to avoidanceofdoubt@gmail.com does that need to be part of the code? or somewhere else? I know... I'm being blonde again...


Lawls :lol:
  • missy
  • Student
  • Student
  • User avatar
  • Posts: 92
  • Loc: london

Post 3+ Months Ago

where is the php part?
do I need to use the t01 t02 codes or exactly what you wrote?
This looks way too complicated. I thought it would be one simple string of code to tewll the form to send instead of clear, and where to send it.

And yes, I should bleach my hair to give people full advance warning of the impending blondness....

Thanks for bearing with me! :-)

Missy xx
  • classified
  • Expert
  • Expert
  • User avatar
  • Posts: 540
  • Loc: Bahrain

Post 3+ Months Ago

maybe an sample file will help ...
gimme sometime ...
  • classified
  • Expert
  • Expert
  • User avatar
  • Posts: 540
  • Loc: Bahrain

Post 3+ Months Ago

not exactly what i promissed but found a better one with explanation !
http://www.kirupa.com/developer/actions ... _email.htm

and source file ...

another one

http://www.sephiroth.it/tutorials/flashPHP/email/
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

missy wrote:
where is the php part?
This looks way too complicated. I thought it would be one simple ...

if everything would've been simple, life would've been boring :P
if that looks complicated to you then ... you just need to focus a little bit and try to understand the code. Is so easy but you have to learn more to grasp the concepts. Everything seems complicated in the beginning.

As for t01, t02, t03 ... they probably are the variables linked to the input texts from the form
  • missy
  • Student
  • Student
  • User avatar
  • Posts: 92
  • Loc: london

Post 3+ Months Ago

ok, so I figured out the php stuff, tried the code, but flash didn't like it. it said

**Error** Symbol=page22, layer=Layer 9, frame=1:Line 13: Statement must appear within on handler
btnSend.onPress = function()

it said that for each line. is the 'on handler' a bracket or quote mark?

I did actually get a mail to send via php, so I'm all excited again!

IceCold wrote:
so ... here you go .. in flash:
Code: [ Select ]
this.createEmptyMovieClip("mcForm", 0);
mcForm.mailTo = "avoidanceofdoubt@gmail.com";
mcForm.mailSubject = "test subject";
mcForm.mailFrom = "from email here"
mcForm.mailMessage = "test message";
// all of these can be loaded from dynamic texts
btnSend.onPress = function()
{
  mcForm.getURL("sendmail.php", "_blank", "POST");
}
  1. this.createEmptyMovieClip("mcForm", 0);
  2. mcForm.mailTo = "avoidanceofdoubt@gmail.com";
  3. mcForm.mailSubject = "test subject";
  4. mcForm.mailFrom = "from email here"
  5. mcForm.mailMessage = "test message";
  6. // all of these can be loaded from dynamic texts
  7. btnSend.onPress = function()
  8. {
  9.   mcForm.getURL("sendmail.php", "_blank", "POST");
  10. }

is in the php part (name it sendmail.php):
Code: [ Select ]
<?
$to = $_POST["mailTo"];
$subject = $_POST["mailSubject"];
$msg = $_POST["mailMessage"];
$from = $_POST["mailFrom"];
mail($to, $subject, $msg, $from);
?>
  1. <?
  2. $to = $_POST["mailTo"];
  3. $subject = $_POST["mailSubject"];
  4. $msg = $_POST["mailMessage"];
  5. $from = $_POST["mailFrom"];
  6. mail($to, $subject, $msg, $from);
  7. ?>



And thanks for the tutorials :-)

I'm nearly there, I can smell it!

Missy xx
  • missy
  • Student
  • Student
  • User avatar
  • Posts: 92
  • Loc: london

Post 3+ Months Ago

ok more progress!

I tried
Code: [ Select ]
on (release) {form.loadVariables("email.php","POST");
}
  1. on (release) {form.loadVariables("email.php","POST");
  2. }


on the send button, all the parts of the form have a var already (t01 etc)

why doesn't this work?

aaaaaaaggghhh! poxy flash!

m xx
  • missy
  • Student
  • Student
  • User avatar
  • Posts: 92
  • Loc: london

Post 3+ Months Ago

just realised my php file is named sendmail.php not mail.php so I changed it on the button and it STILL DOESNT WORK! WHY?!
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

who exactly told you that: movieClip.loadVariables is sending variables?

my_mc.loadVariables: Method reads data from an external file and sets the values for variables in my_mc. The external file can be a text file generated by a CGI script, Active Server Page (ASP), or PHP script and can contain any number of variables.

looking on my code, i see: mcForm.getURL("sendmail.php", "_blank", "POST"); to send variables to the php form.

Post Information

  • Total Posts in this topic: 15 posts
  • Users browsing this forum: No registered users and 15 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.