Search for mail content with Mutt
search
and limit
can also actually search inside messages, depending on the search patterns you give. From the Patterns subsection of the Mutt reference:
~b EXPR messages which contain EXPR in the message body
=b STRING If IMAP is enabled, like ~b but searches for STRING on the server, rather than downloading each message and searching it locally.
~B EXPR messages which contain EXPR in the whole message
=B STRING If IMAP is enabled, like ~B but searches for STRING on the server, rather than downloading each message and searching it locally.
That is, ~b
only searches in the body, whereas ~B
also searches in the headers.
Note that this can be quite slow, since it may have to download each message one by one if they are not already cached. If you have a mutt version greater or equal to 1.5.12, you can cache the ones you are downloading for later use by setting message_cachedir
to a directory where you want to store message bodies, which can significantly speed up searching them (and the same for headers with header_cache
).
You can add flags to the search command, to search the body use the search function with
the ~b
modifier. So to search for cheesecake inside your mail bodies:
/~b cheesecake
Put ~b
in front of your search pattern to search only in the body of mails. For searching additionally in the headers, use ~B
There are plenty of other patterns described in the mutt manual.