Your Linux Data Center Experts

Recently I was reading about one of the other e-mail software packages which had the idea of virtual folders. The idea was that you could have something that acted like an e-mail folder, but was based on search results or other types of mappings. I was thinking that this would be a nice feature, but then I realized that mutt already has this functionality, I just wasn't using it.

In mutt there is the “limit” command, by default mapped to “l”. Mutt will then ask for a pattern to limit the view by. The result is that your message list only shows the messages that match the pattern. Normally my mailbox hovers between 20 and 100 messages, and I find this useful to zero in on messages related to a particular task.

Another case I find this very useful for is when I'm looking in either my archive of sent or received messages. In the past I would use the search function in mutt (bound to “/”) to try to find messages. However, in a month I may have over 6,000 messages in my incoming archive and over 600 in my sent archive. Jumping from one message to another requires that I filter out the surrounding messages which usually aren't related to what I'm looking for. Using a limit here, I will usually limit it based on sender or recipient so that I can more quickly locate the needle in the haystack.

The patterns you can specify are quite rich, allowing limits based on the subject, sender or recipient, arbitrary headers or even the whole body. You can also limit based on date ranges, messages containing PGP keys, mailing list messages, new or old messages, messages that have been replied to or messages that have or have not been read, etc… Where appropriate, these can match regular expressions.

These patterns can also be grouped and combined with AND, OR, and NOT operations to become very powerful indeed. For example, you could create a view of messages 1 to 2 weeks old that are are less than 100KB in size and were sent to or from user@example.com by using the pattern “~d 1w-2w ~z <100000 (~f user@example.com | ~t user@example.com)”

In the above, the tilde (~) followed by a letter specifies a pattern type, where “~d” matches a date, “~z” matches a size, etc. Parenthesis group expressions, and the vertical bar specifies logical OR operations. Otherwise, patterns are joined using logical AND.

Extremely power and easy to use. I really like being able to limit my mailbox down to items related to a particular task while I'm doing it, then expand back up when I'm done.

For example, Scott and I have been trying to be more organized and in particular are coming up with lists of tasks for the day as the first thing in the morning. One thing that's important to do is to make sure that we aren't missing things that have recently come in. By limiting the mailbox view to things over the last day (“l ~d <1d”), it makes it much easier to see what new things have come in.

While I'd like to work my mailbox down to 0 items regularly, I often have things that are just holding place in my main box. This is largely because I'm not very good at regularly checking other boxes. Using the 1 day limit helps me make sure I triage the new messages to become part of my task list for the day.

To return back to the full list of messages, you can use the pattern “.*” (by default it searches subjects, and this matches all subjects), or “~A” to match all messages.

comments powered by Disqus

Join our other satisfied clients. Contact us today.