• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

CFPOP Sort Order

New Here ,
Nov 30, 2010 Nov 30, 2010

Copy link to clipboard

Copied

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.

TOPICS
Advanced techniques

Views

1.9K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 30, 2010 Nov 30, 2010

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Nov 06, 2011 Nov 06, 2011

Copy link to clipboard

Copied

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

I am looking for an answer to this .

Thanks, Pierre.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Nov 08, 2011 Nov 08, 2011

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Nov 08, 2011 Nov 08, 2011

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Nov 08, 2011 Nov 08, 2011

Copy link to clipboard

Copied

I suspect that you will need to escape the column name "date" which is a reserved word as . Add square braces around the keyword. Keywords and how to escape them are contained in the "Escaping reserved keywords" section of the Query of Queries documentation.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Nov 09, 2011 Nov 09, 2011

Copy link to clipboard

Copied

Thanks, with [ ]  it does work.

So I first need to cfpop all messages, (which can be long process)

Then reorder by date

Then display headers from 1 to 10 ,

Then next 10, etc..

If I could order by date at 1st process cfpop, I could ask for only the 10 first.

and the process will take less time.

Ast it is now, the 1st step retrieve all mails, which is long.

Thanks for help.

Pierre.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Nov 09, 2011 Nov 09, 2011

Copy link to clipboard

Copied

You might use the getHeaderOnly option to limit the size of results in your query. Sort those results, get the UID values for the messages you are interested in. Then create a second CFPOP connection using UID attribute to only get the ten messages you want.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Nov 09, 2011 Nov 09, 2011

Copy link to clipboard

Copied

LATEST

Yes , right,

But I wanted to know if messages have attached files. (when listing headers)

And to know this, I must use the "getall" option, without attachmentpath,

then attachmentfiles are not loaded.

And the variable "attachments" says if attachments exist (if not empty).

So I keep the load of "body" , which takes more time, true.

i will use it like this, and see if too much long or acceptable.

thanks for your participation.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation