4

By default, Mutt wants to archive messages to folders by sender name. So when I hit s it prompts me with Save to mailbox ('?' for list): =sendername. I'd like to have it default to =INBOX.Archives.2015 instead.

I don't think I need a macro, which is how this one was solved: mutt: save message to specific folder

I just want to set a default so that the prompt is always =INBOX.Archives.2015 (I can reset it once a year, the year doesn't need to update.)

4

You need to add a line such as the following to your .muttrc:

save-hook . '=INBOX.Archives.2015'
  • I read the save-hook documentation three times and got the impression it would automatically move messages into the folder, without waiting until I save. – Amanda Nov 10 '15 at 22:54
  • mutt does nothing like that by itself, for that functionality you need procmail or something like that (I personally have exim as MTA and use its filtering features in my .forward file instead of procmail). – wurtel Nov 11 '15 at 7:51
  • So save-hook will just tweak the folder that Mutt suggests when I hit <kbd>s</kbd>? – Amanda Nov 13 '15 at 7:04
  • Yes. You can still modify it, of course. – wurtel Nov 13 '15 at 7:47
1

If you don't want to update your save-hook every year, you can also use %[%Y] to automatically expand the year. As described in the HTML mutt manual, it is possible to apply the same expandos as those used in the $index_format.

Hence the following:

save-hook . =INBOX.Archives.%[%Y]

would expand to the year (local time) that message was sent. Or if you want to default to the current year, irrespective of the date on the message itself, you would use:

save-hook . =INBOX.Archives.%<%Y>

You can expand this approach to any format supported by the strftime(3) function. So you could set of monthly archives with:

save-hook . =INBOX.Archives.%[%Y.%m]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.