Adobe COLDFUSION 9 Manual page 1320

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Using External Resources
Incoming message handling example
The following example places data that is contained in the body of the message from the Flex application into a
structure. It then uses the contents of the structure to generate an e-mail message.
<cfcomponent displayname="SendEmail" hint="Handles incoming message from Flex">
<cffunction name="onIncomingMessage" returntype="any">
<cfargument name="event" type="struct" required="true">
<!--- Create a structure to hold the message object sent 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#">
<!--- Send e-mail with values from the structure. --->
<cfmail from="#mailfrom#"
to="#mailto#"
subject="#mailsubject#">
<cfoutput>#mailmessage#</cfoutput>
</cfmail>
</cffunction>
</cfcomponent>
If the Flex application sends the message in the header instead of in the body, you create and populate the structure,
as the following example shows:
<cfset messageheader = StructNew()>
<cfset messageheader.sendto = event.data.headers.emailto>
<cfset messageheader.sentfrom = event.data.headers.emailfrom>
<cfset messageheader.subject = event.data.headers.emailsubject>
<cfset messageheader.mailmsg = event.data.headers.emailmessage>
<cfset mailfrom="#messageheader.sentfrom#">
<cfset mailto="#messageheader.sendto#">
<cfset mailsubject="#messageheader.subject#">
<cfset mailmessage ="#messageheader.mailmsg#">
New methods introduced in ColdFusion 9.0.1
The following new methods have been introduced in ColdFusion Messaging Gateway CFCs:
allowSend
allowSubscribe
Both the methods take
subtopic
These methods help you place control over subscribing and sending data to a particular subtopic.
Note: To call these methods on their gateway CFC, specify the gateway id under the messaging destination in messaging-
config.xml (Web_INF/Flex). By default, the value is
Data translation
The following table lists the ColdFusion data types and the corresponding Flash or ActionScript data type:
as the parameter.
.
*
Last updated 8/5/2010
1315

Advertisement

Table of Contents
loading

Table of Contents