Adobe COLDFUSION 9 Manual page 1225

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

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Using External Resources
2
Use
tag
cfexchangemail
message you got in the previous step. Also specify an attachmentPath attribute value that is under your web root,
so that you can access the saved files by using a URL.
3
Search through the
HTMLMessage
ID) value for each image.
Search the attachments query that you got in step 1. For each row with a
4
get the corresponding
attachmentFilePath
Replace every
tag
5
img
src
value.
6
Display the resulting HTML.
The following example shows how to display a message with an inline image by retrieving the image from the
attachments.
<!--- Open the connection to the Exchange server. --->
<cfexchangeconnection
action="open"
username = "#user1#"
password = "#password1#"
server = "#exchangeServerIP#"
connection = "testconn">
<!--- Get the mail message. --->
<cfexchangeMail action="get" connection ="testconn" name="getMail">
<cfexchangeFilter name="Subject" value="sample inline image">
</cfexchangeMail>
<cfdump var="#getMail#">
<!--- The following code assumes we found only one matching message. --->
<cfoutput query="getMail">
<cfset theUID = #getMail.UID#>
<cfset htmlmessage = getMail.htmlmessage>
</cfoutput>
<!--- Get the message attachments. --->
<CFExchangeMail action="getAttachments" UID ="#theUID#" connection="testconn"
name="attachments"
attachmentPath="C:\ColdFusion8\wwwroot\My_Stuff\cfexchange\Book\attachments"
generateuniquefilenames="no">
<!--- Extract the image names from the mail message --->
<!--- Initialize the index into the message used in finding --->
<cfset findstart = 1>
<!--- Use an index loop to find all image source entries in the message --->
<!--- This example supports up to 25 inline images --->
<cfloop index="i" from="1" to="25">
<!--- find a cid: entry --->
<cfset stringStart[i] = Find('"cid:', htmlmessage, findstart)>
<!--- Exit the loop if no match was found --->
<cfif (stringstart[i] EQ 0)>
<cfbreak>
</cfif>
action to get the message attachments. Specify the UID of the mail
getattachments
field text that you got in step 1 and find the image items. Get the CID (content
column value.
attribute value with the
attachmentFilePath
Last updated 8/5/2010
column value that you got in step 3,
CID
field value that corresponds to the cid
1220

Advertisement

Table of Contents
loading

Table of Contents