On 06Jul2021 18:19, Julius Hamilton <julkh...@gmail.com> wrote:
>Thanks very much.
>I am now looking into using a Python IMAP library.

Note that imaplib from the Python standard library is only a low level 
wrapper for the protocol, not a fulling fledged "remote IMAP mailbox" 
tool (which you might expect to trweat it like a map or something).  
There are other IMAP modules in PyPI offering higher level access.

>However, I think there must be a way to just dump the contents of a Mutt
>page, and that could be an easier short-term solution.
>You mentioned there being a print function.

See the manual for "print", "print_command", "print_decode". The 
defaults are ok, except that you would want to set "print_command" to 
something like "cat" for the message to appear on stdout.

A bit of experimentation reveals that <pipe-message> is as good as 
<print-message>, so something like this:

    mutt -e 'set wait_key=no; push 
"<tag-pattern>.<enter><tag-prefix><pipe-message>cat<enter><quit>"' -f YOUR_MBOX

seems to work. Open mailbox, tag every message (or whatever subset you 
want), pipe through "cat", quit.

This is all a bit of a hack - mutt is inherently an interactive 
programme and the above works my pushing keystrokes onto the input 
stream.

Cheers,
Cameron Simpson <c...@cskk.id.au>

Reply via email to