Skip to main content
Participating Frequently
November 30, 2010
Question

CFPOP Sort Order

  • November 30, 2010
  • 2 replies
  • 2249 views

Hi All!  Is there a trick for sorting the email messages by newest first instead of oldest first?  I have the CFPOP working fine - I just want to only pull out the most recent 35 or so.

<cfpop action="getheaderonly"
           name="qGetMessages" startrow="1" maxrows="35"
           server="#Pop_Server#"
           username="#Pop_Username#"
           password="#pop_password#">

Do I need another query in addition to this one?  Any ideas are much appreciated.

This topic has been closed for replies.

2 replies

Inspiring
November 6, 2011

Did you find the solution to reorder from the most recent to the oldest ?

I am looking for an answer to this .

Thanks, Pierre.

Inspiring
November 8, 2011

CFPOP creates a query object result.  You could try using Query of Queries to query that result to get the order you desire.

References:

"Using Query of Queries"

http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec22c24-7bb8.html

Inspiring
November 8, 2011

I already tried this, query of query,

but I get an error,

i think it does not consider the CFPOP result as a query (GetHeaders).

I used the name of the CFPOP as the query name

<cfquery name="GetHeaders_o" dbtype="query">

    select * from GetHeaders

    order by date desc

</cfquery>

It does not like "date" , but date is a column of the CFPOP.

I tried to put the column number (as said in the doc)

Then, it is 6 for date.

<cfquery name="GetHeaders_o" dbtype="query">

    select * from GetHeaders

    order by 6 desc

</cfquery>

No error, but the date order is not good. (time order)

any other idea ?

Thanks for help.

Pierre.

Inspiring
November 30, 2010

I guess this have something to with your mail server. I use cfpop on my mail server and it sends me the most resent mails first. But in your case, if the mail server sends the oldest mails first then you may have to get everything first and use query of query for the sorting.

- Sam