EmailReader Details

Nathan Strutz commented on my last post about EmailReader that he didn't "get" it.  Looking back, I realized I didn't bother to communicate it's purpose very clearly in my post, so here's another one that should do a better job.

EmailReader is designed for being run from a scheduled task to do "something", where "something" is up to you.  You implement a handleMessage method that accepts information detailing a single message from the POP server, and you do something with it.  EmailReader will take care of some basic validity checks (valid sender, has a valid attachment, etc.), as well as post processing cleanup (deleting from the server, deleting downloaded attachments).

It can certainly be used interactively as well, but interactive checking requires a rather different mindset that this component doesn't accomodate gracefully. 

The specific use case was emailing pictures from my phone to my blog, but I wanted to create a general solution for emailing "stuff" to an application.  This is it.

I've posted the current draft of the CFCExplorer-generated docs for the component, so you can take a look.  Typos, inaccuracies, and whatever other issues are likely present; they'll be better before initial release.  Hopefully that'll better illustrate the scope of the component.  processMessages is the method called from your scheduled task, but handleMessage is the interesting one.

2 responses to “EmailReader Details”

  1. Sami Hoda

    Sounds cool! I'd love to try it out!

    Sami

  2. Nathan Strutz

    Thanks for explaining it. That sounds exactly what I'll need for that project I mentioned, which is a couple weeks off it looks.

    I've made my own email popping jobs a number of times, and never thought to use a CFC to make them more reusable. Great idea! I'll be sure to take a look at it when you kick it out to us!