Here's a working example. Compile the mailer.mxml file, put it and
flexmailer.php in the same directory (on a php server) then request the
SWF file in a browser:

flexmailer.php::
<?php
        $to = stripslashes($_POST['to']);
        $subject = stripslashes($_POST['subject']);
        $body = stripslashes($_POST['body']);

        $headers .= "From: <[EMAIL PROTECTED]>\n";
        $headers .= "Reply-To: <[EMAIL PROTECTED]>\n";

        @ $send = mail($to,$subject,$body,$headers);
        if ($send) {
         echo "<result>success!</result>";
        } else {
         echo "<result>failure!</result>";
        }
?>

mailer.mxml::
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";>
        <mx:HTTPService id="sendMailService" url="flexmailer.php"
useProxy="false" method="POST">
                <mx:request>
                        <to>{to.text}</to>
                        <subject>{subject.text}</subject>
                        <body>{body.text}</body>
                </mx:request>
        </mx:HTTPService>
        <mx:Form width="400">
                <mx:FormItem label="To:">
                        <mx:TextInput id="to" text=""/>
                </mx:FormItem>
                <mx:FormItem label="Subject:">
                        <mx:TextInput id="subject" text=""/>
                </mx:FormItem>
                <mx:FormItem label="Body:">
                        <mx:TextArea id="body" text=""/>
                </mx:FormItem>
                <mx:Button label="Submit"
click="sendMailService.send()"/>
        </mx:Form>
        <mx:Label id="l1" text="{sendMailService.lastResult.result}"/>
</mx:Application>

hth,
matt horn
flex docs


> -----Original Message-----
> From: [email protected] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Mike Potter
> Sent: Thursday, June 29, 2006 10:00 AM
> To: [email protected]
> Subject: [flexcoders] Re: send email with PHP
> 
> You can see how Flex and PHP can interact with some of the 
> examples that I've written... They are posted on the Flex and 
> PHP developer center:
> http://www.adobe.com/devnet/flex/flex_php.html 
> <http://www.adobe.com/devnet/flex/flex_php.html> 
> 
> Mike
> 
> --- In [email protected] 
> <mailto:flexcoders%40yahoogroups.com> , "jf.saldanha" 
> <[EMAIL PROTECTED]> wrote:
> >
> > To me, in this days of Flex are important see a example of Flex and 
> > PHP on send a Email dont see anything on the Web.
> > 
> > If someone have or see a example or a tutorial about that.
> > 
> > Thanks
> >
> 
> 
> 
>  
> 


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Something is new at Yahoo! Groups.  Check out the enhanced email design.
http://us.click.yahoo.com/SISQkA/gOaOAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~-> 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to