To sort messages in the current folder, use `S'. Then you will be asked to input the field name as follows:
Sort by? (default date):
Strings stored in the specified field should not be compared as text in some cases. For example, while Subject: can be considered as text, Date: and X-Mail-Count: should be treated as date and number, respectively. In this way, we call how to treat stored strings "mode". Default modes for typical field names are configured in `mew-sort-key-alist'.
When you want to specify the mode of sorting, the mode is followed by `:'. For example, to sort with X-Mail-Count field as arithmetic value (not text), input like this:
x-mail-count:num
The case distinctions of field names and modes are ignored. And you can complete field names and modes with `TAB'.
The default field name, when you asked "Sort by?", can be specified to `mew-sort-default-key'. The following is an example to change the default value from "date" to "x-ml-count".
(setq mew-sort-default-key "x-ml-count")
You can also set a default field name for each folder by `mew-sort-default-key-alist'. For folders not explicitly specified here, `mew-sort-default-key' is used for their default field name. The following is an example that specifies "subject" for the +inbox folder and "x-mail-count" for the +mew-dist folder.
(setq mew-sort-default-key-alist '(("+inbox" . "subject") ("+mew-dist" . "x-mail-count")))
This is the summary of the sorting commands: