Create The Coldfusion Application - MACROMEDIA COLDFUSION MX 7.0.2-USING COLDFUSION MX WITH FLEX 2 Use Manual

Table of Contents

Advertisement

<mx:TextInput x="103" y="13" width="291" id="emailto" editable="true"/>
<mx:TextInput x="103" y="43" width="291" id="emailfrom"
editable="true"/>
<mx:TextInput x="103" y="73" width="291" id="emailsubject"
editable="true"/>
<mx:TextArea x="103" y="102" width="291" height="236"
id="emailmessage" editable="true"/>
<mx:Label x="63" y="15" text="To:" textAlign="right"/>
<mx:Label x="37" y="103" text="Message:" textAlign="right"/>
<mx:Label x="52" y="45" text="From:"/>
<mx:Label x="37" y="75" text="Subject:"/>
<mx:Button x="402" y="13" label="Send" id="emailsend"
click="sendMessage();"/>
<mx:Label id="messagestatus" x="103" y="350" width="291" text="Message
not sent yet."/>
</mx:Application>

Create the ColdFusion application

The ColdFusion application puts the information received from the Flex application in a
structure. It then sends an e-mail message by using elements of the structure.
A ColdFusion application can handle data sent from a Flex application in either the header or
the body of the message. The sample Flex application sends the data in the body of the
message. To create the ColdFusion application, you create a ColdFusion component.
Create a blank file and enter the following code:
1.
<cfcomponent
displayname="Send e-mail from Flex application"
hint="Handles incoming message from Flex">
<!--- Handle incoming message. --->
<cffunction name="onIncomingMessage" returntype="any">
<cfargument name="event" type="struct" required="true">
<!--- Create a structure to hold the message object from Flex. --->
<cfset messagebody = event.data.body>
<!--- Populate the structure. --->
<cfset mailfrom="#messagebody.emailfrom#">
<cfset mailto="#messagebody.emailto#">
<cfset mailsubject="#messagebody.emailsubject#">
<cfset mailmessage ="#messagebody.emailmessage#">
32
Use ColdFusion Event Gateway Adapter

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion mx

Table of Contents