cfexchange - get messages example

This is an Example showing the usage of cfexchange tags.This example shows how to connect and get messages from the server. Note: You need to update the Application.cfm file with the appropriate values for exchange server, user ids, password, email ids.

<cftry>
<!--- Send an email, to verify --->
<cfmail to = "#email1#"   
      from = "#email2#"   
      subject = "Testing cfexchange message 1"   
      username = "#user1#"   
      password = "#password#"   
      server = "#exchangeServerIP#"   
      port = "25">

This message is sent by cfexchange test.
</cfmail>

<!--- Sleep for sometime so that the message is transferred/sent to the server. ---->
<cfscript>sleep(15000);</cfscript>

<!--- Connect to the server using cfexchangeconnection. ---->
<cfexchangeConnection
action="open"
username ="#user1#"
password="#password#"
server="#exchangeServerIP#"
connection="testconn1">


<!--- Get the mails from the server using cfexchangemail. ---->
<cfexchangeMail action="get" connection="testconn1" name="getMessages">
<cfExchangeFilter name="subject" value="message 1">
</cfexchangeMail>

<cfdump var="#getMessages#">

<!--- Close the connection. ---->
<cfexchangeConnection
action="close"
connection="testconn1">

<cfcatch>
   <cfoutput>#CFCATCH.message#</cfoutput>
</cfcatch>
</cftry>

You can download the source files using the download button.

Comments
BlogCFC was created by Raymond Camden. This blog is running version 5.9.002. Contact Blog Owner