Sending all mail in IMAP folder from command line

Cameron Simpson cs at cskk.id.au
Sun Nov 15 21:19:21 UTC 2020


On 15Nov2020 09:56, Olli Savolainen <olli at savolai.net> wrote:
>I have draft messages appearing in an imap folder. I would like to 
>write a script that reads a message (or all messages) from that folder 
>and sends it as it is, then moving the message to imap Sent folder.
>
>It seems something like mutt -H would do the job, just can’t figure out how to get it to read the message from the imap Drafts folder instead of a file.
>
>Also not sure what is the file format mutt -H expects if I were to read the imap folder messages into a file first?
>
>(If mutt doesn’t work for this I would also welcome help in the form of 
>strategic pointers. Also say, a php, python or powershell solution 
>would be ok - if you know this particular task would be easy in some 
>another ecosystem, tips are welcome. This seems like such a simple task 
>to automate that I’m mainly trying to minimize amount of code I’ll need 
>to maintain.)

Is this once off or to happen regularly?

You could for this:
- save all the messages to a local filesystem maildir folder
- write a short shell loop to run mutt -H for each message file in the 
  maildir

Cheers,
Cameron Simpson <cs at cskk.id.au>


More information about the Mutt-users mailing list