Someone over at Sitepoint asked this question:
http://www.sitepoint.com/forums/showthread.php?t=432441

which led me to whip up the following code. I'd be interested in seeing if
it could be improved upon. Anyone have any suggestions.

[code]
<!--- get all emails --->
<cfpop server="your mail server" username="the email address to check"
password="password" action="getAll" name="emails">

<!--- loop over the emails to see if there are any legit records in
there --->
<cfloop query="emails">

        <!--- make sure that the current email being evaluated matches our
"special" email --->
        <cfif FindNoCase("special email two",to) OR FindNoCase("special email
one",to)>

                <!--- prep the variables for insertion to the database --->
                <cfif FindNoCase("special email two",to)>
                        <cfset fk_user_id = 1>
                <cfelseif FindNoCase("special email one",to)>
                        <cfset fk_user_id = 12>
                </cfif>
                <cfset thedate = DateFormat(Now(),"yyyy-mm-dd") & " " &
TimeFormat(Now(),"H:mm:ss")>
                <cfset title = subject>
                <cfset content = ListLast(body,"~~~~~")>
                <cfset cats = ListFirst(body,"~~~~~")>
                <cfset status = "publish">

                <!--- insert into database --->
                perform your db insert here

                <!--- get newest news post --->
                get the id of the just inserted record

                <!--- loop over the categories to get the corresponding id --->
                <cfset counter = 0>
                <cfloop index="li" list="#cats#" delimiters=":">
                        look upthe current category and make sure that one 
exists with that name

                        <!--- did we get a hit? --->
                        <cfif getCat.recordcount>
                                <!--- we did get a hit, so insert a record--->
                                insert the user/newsid record here8

                                <!--- keep a count to make sure that at least 
ONE category got
added --->
                                <cfset counter = counter + 1>
                        </cfif>
                </cfloop>

                <!--- if counter is still zero, then delete the news post --->
                <cfif NOT counter>
                        delete the news post
                </cfif>

        </cfif>
</cfloop>

<!--- everything went well, so delete all emails --->
<cfpop server="your mail server" username="the email address to check"
password="password" action="getAll" name="delete">
[/code]

<!----------------//------
andy matthews
web developer
certified advanced coldfusion programmer
ICGLink, Inc.
[EMAIL PROTECTED]
615.370.1530 x737
--------------//--------->


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:258694
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to