Search and limit from command line
Julius Hamilton
julkhami at gmail.com
Sat Mar 20 19:24:08 UTC 2021
Thanks very much.
I'm a beginner to this, so I'd appreciate being able to ask a few
questions about setting this up.
It asked for the path to my email archive. I had a folder on my desktop
called Mail, but it's empty, and not connected to Mutt. I always just
launch Mutt "live", and it connects to my gmail server, when I want to
check my email.
Do I need to somehow integrate Mutt with that archive folder for notmuch
to work? How do I do that? Or should I give it somehow a different path, into my Gmail?
Thanks very much,
Julius
On Sat, Mar 20, 2021 at 11:11:43AM +0100, Jens John wrote:
> On Sat, 20 Mar 2021, at 10:42, Julius Hamilton wrote:
> > Hello Mutt users,
> >
> > I would like to know if there is a way to retrieve a list of emails from
> > a particular user at stdout in bash, rather than launching the mutt
> > application. Or, if one can launch mutt with the search already
> > executed. I currently know how to launch mutt, and then search for a
> > particular sender.
> >
> > Or, if someone knows commands from a similar tool to achieve this.
>
> Use notmuch.
>
> $ notmuch search 'from:Julius Hamilton'
> thread:0000000000015cd4 25 mins. ago [1/1] Julius Hamilton; Search and limit from command line (inbox unread)
>
> $ notmuch search --format=json 'from:Julius Hamilton'
> [{"thread": "0000000000015cd4", "timestamp": 1616233332, "date_relative": "26 mins. ago", "matched": 1, "total": 1, "authors": "Julius Hamilton", "subject": "Search and limit from command line", "query": ["id:YFXDdAEhEL3NU0sj at localhost", null], "tags": ["inbox", "unread"]}]
>
> I have integrated it with my mutt like so (I fetch email using isync/mbsync instead of using mutt's IMAP support):
>
> macro generic,index,pager <F2> "<shell-escape>mbsync -a<enter><shell-escape>notmuch new<enter>" "fetch mail"
> macro index <F7> \
> "<enter-command>set my_old_pipe_decode=\$pipe_decode my_old_wait_key=\$wait_key nopipe_decode nowait_key<enter>\
> <shell-escape>notmuch-mutt -r --prompt search<enter>\
> <change-folder-readonly>`echo ${XDG_CACHE_HOME:-$HOME/.cache}/notmuch/mutt/results`<enter>\
> <enter-command>set pipe_decode=\$my_old_pipe_decode wait_key=\$my_old_wait_key<enter>" \
> "notmuch: search mail"
> macro index <F8> \
> "<enter-command>set my_old_pipe_decode=\$pipe_decode my_old_wait_key=\$wait_key nopipe_decode nowait_key<enter>\
> <pipe-message>notmuch-mutt -r thread<enter>\
> <change-folder-readonly>`echo ${XDG_CACHE_HOME:-$HOME/.cache}/notmuch/mutt/results`<enter>\
> <enter-command>set pipe_decode=\$my_old_pipe_decode wait_key=\$my_old_wait_key<enter>" \
> "notmuch: reconstruct thread"
>
> Macros given as a reference, not as an example of especially good scripting. I haven't touched or improved these definitions in years.
More information about the Mutt-users
mailing list