Matt,

That's pretty nifty.  I use a number of the API features of smarter mail
integrated into my company management/hours/tasks system.  It's definitely a
great platform and worth a look.

-mark

-----Original Message-----
From: Money Pit [mailto:websitema...@gmail.com] 
Sent: Monday, September 02, 2013 5:53 PM
To: cf-talk
Subject: Re: database driven mail server


I rolled my own solution with CF coupled to Smartermail's support of
Plus-addressing.  If you aren't familar with it, its pretty powerful.

Lets say my email is u...@domain.com.  I send mail with CF as usual and set
CFMAIL's FailTo parameter to 'failedmail+1...@domain.com',  where 1234 is
the primary key ID number for the user record.

So bounces come back and plus addressing puts every failure into
failedm...@domain.com.  I use CFPOP with GETHEADERSONLY (!) to read that
mailbox periodically and parse thru returned emails, figuring out what
happened from the headers and doing stuff accordingly.  Sound like what
you're after?  A quick snippet to illustrate the maintenance process (which
I cfschedule):

<cfpop
    server="#servername#"
    username="#failUser#"
    password="#failPwd#"
    action="GETHEADERONLY"
    name="GetHeaders">

<cfloop
    query="getHeaders">
    <!---
    this header identifies the email
    --->
    <cfset variables.emailID=getHeaders.UID>
    <!---
    this pulls out the user ID from the return address.  Note if the email
    itself is stored in a db then this next step is unnecessary
    and so is plus addressing as you could just log the user id
    with the email record
    --->
    <cfset variables.usrID=listLast(listFirst(getHeaders.to,"@"),"+")>
    <!---
    run tests here, as detailed as you like. For example
    I keep track of failure counts and scrub emails from my list
    if they reach three strikes.
    --->
    <cfif findNoCase("fail",getHeaders.subject,"1")> blah </cfif>
    <cfif findNoCase("error",getHeaders.subject,"1")> woof </cfif>
    <!---
    do more clever stuff here as needed.
    Then delete the failed email from the inbox and continue.
    --->
    <cfpop
        server="#servername#"
        username="#failUser#"
        password="#failPwd#"
        action="DELETE"
        uid="#variables.emailID#">
</cfloop>


-- 
--m@Robertson--
Janitor, The Robertson Team
mysecretbase.com




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:356693
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to