WebMail Lite Documentation

Messages sorting

As of 9.7.1

By default, messages are sorted by date in reverse order.

The sorting behavior is adjusted in data/settings/modules/Mail.config.json file, MessagesSortBy configuration option. By default, it looks like:

"MessagesSortBy": [
   {
      "Allow": true,
      "List": [],
      "DefaultSortBy": "arrival",
      "DefaultSortOrder": "desc"
   },
   "array",
   null,
   "Defines a set of rules for sorting mail"
],

If you set DefaultSortBy to "date" there, the messages will be sorted by sent date rather than message date obtained from IMAP server.

To allow for custom sorting, that needs to be replaced with:

"MessagesSortBy": [
   {
      "Allow": true,
      "List": [
         {
            "SortBy": "arrival",
            "LangConst": "LABEL_SORT_BY_DATE"
         },
         {
            "SortBy": "from",
            "LangConst": "LABEL_SORT_BY_FROM"
         },
         {
            "SortBy": "to",
            "LangConst": "LABEL_SORT_BY_TO"
         }
      ],
      "DefaultSortBy": "arrival",
      "DefaultSortOrder": "desc"
   },
   "array",
   null,
   "Defines a set of rules for sorting mail"
],

With the above configuration applied, users will be able to sort the messages by date, sender and recipient.

If your IMAP server is having troubles with SORT functionality, try setting "Allow" to false.

As of v8.3

By default, messages are sorted by date in reverse order.

The sorting behavior is adjusted in data/settings/modules/Mail.config.json file, MessagesSortBy configuration option. By default, it looks like:

"MessagesSortBy": [
   {
      "Allow": true,
      "List": [],
      "DefaultSortBy": "arrival",
      "DefaultSortOrder": "desc"
   },
   "array"
],

If you set DefaultSortBy to "date" there, the messages will be sorted by sent date rather than message date obtained from IMAP server.

To allow for custom sorting, that needs to be replaced with:

"MessagesSortBy": [
   {
      "Allow": true,
      "List": [
         {
            "SortBy": "arrival",
            "LangConst": "LABEL_SORT_BY_DATE"
         },
         {
            "SortBy": "from",
            "LangConst": "LABEL_SORT_BY_FROM"
         },
         {
            "SortBy": "to",
            "LangConst": "LABEL_SORT_BY_TO"
         }
      ],
      "DefaultSortBy": "arrival",
      "DefaultSortOrder": "desc"
   },
   "array"
],

With the above configuration applied, users will be able to sort the messages by date, sender and recipient.

If your IMAP server is having troubles with SORT functionality, try setting "Allow" to false.

See this blog post for examples on advanced use of this configuration option.

Prior to v8.3

By default, emails are sorted by the order they were added in the folder. So if you move a message from one folder to another, it will become the latest message in that folder.

To sort messages by date when they were received by the mail server, set UseSortImapForDateMode to true in data/settings/modules/Mail.config.json configuration file.

Please note that your IMAP server must support SORT extension for that.