views:

64

answers:

3

I am trying to have a kind of observer pattern in ColdFusion

We want to listen to the incoming Email messages and act on them. Scenario is something like this :

Application sends email to the helpdesk system Helpdesk system automatically generates a ticket and responds with an email to the email address of the application The application's email is configured in the Lotus notes Now the application should listen to this incoming email message, decode that and update the coressponding ticketid

I see there is a possibility with Event Gateways, but I am unable to realize the whole picture.

Thoughts or suggestions?

+1  A: 

One way is to setup an email server with IMAP support, and use some sort of polling (every minute, good enough?) in CF using <cfimap> to get the emails.

http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WS371453EC-36D5-44ce-BF1E-750E3016BBD6.html

Henry
+1  A: 

I've created similar applications in the past using cfpop to interogate a mailbox on a scheduled basis.

It was pretty easy to write, but usually gets thrown for a loop when "users" start being "helpful" with the email content.

The other thing is that this isn't instantaneous, but is the process really time critical to the second?

Stephen Moretti
+2  A: 

We have a system like this.

We have a postfix server configured to handle mail for a domain. A small script (Perl) on the postfix server places each email on an ActiveMQ queue.

We have a cluster of CF boxes with the ActiveMQ event gateway listener that takes the messages off the queue and processes them using Java Mail.

The delay between postfix receiving the email and a CF server processing it is generally under 1s.

We needed to do it this way for a number of reasons, processing delay being one of them, dealing with a large cluster of CF which made the POP/IMAP solution complicated, and CF's mail handling not being quite what we wanted were others.

It works great.

Edward M Smith