### 4.9 Sorting Messages

IMAIL provides several commands that change the order of messages within a folder. These commands are closely modelled on those of Rmail. Note that these commands don’t modify the folder itself; they only modify the way that the folder behaves. This means that if a folder buffer is deleted, the sort order associated with that buffer is deleted too.

`C-c C-s C-v`

  Sort messages of current IMAIL folder by arrival time (`imail-sort-by-arrival`). This is the default; this sort undoes any other sorting on the folder.

`C-c C-s C-d`

  Sort messages of current IMAIL folder by date (`imail-sort-by-date`).

`C-c C-s C-s`

  Sort messages of current IMAIL folder by subject (`imail-sort-by-subject`).

`C-c C-s C-a`

  Sort messages of current IMAIL folder by author’s name (`imail-sort-by-author`).

`C-c C-s C-r`

  Sort messages of current IMAIL folder by recipient’s names (`imail-sort-by-recipient`).

`C-c C-s C-c`

  Sort messages of current IMAIL folder by the name of the other correspondent (`imail-sort-by-correspondent`).

The IMAIL sort commands perform a stable sort: if there is no reason to prefer either one of two messages, their order remains unchanged. You can use this to sort by more than one criterion. For example, if you use `imail-sort-by-date` and then `imail-sort-by-author`, messages from the same author appear in order by date.

With a numeric argument, all these commands reverse the order of comparison. This means they sort messages from newest to oldest, from biggest to smallest, or in reverse alphabetical order.