<<< Date Index >>>     <<< Thread Index >>>

Re: set alias for mail folder



"Kyle Wheeler" <kyle-mutt@xxxxxxxxxxxxxx>:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Monday, October 13 at 08:05 PM, quoth Percy Foreman:
I'm trying to figure out how to alias a mail folder so I can type
'@folder' instead of '/home/test/mail/inbox' when trying to change.

I tried putting
alias folder '/home/test/mail/inbox'
into muttrc, but mutt responds with
opening _home_test_mail_inbox
Of course he can't find it, so I don't know.

I think you're misunderstanding the documentation. I'm guessing that
you looked in the manual under "Mailbox Shortcuts" and found:

     @alias -- refers to the default save folder as determined by the
     address of the alias

But that doesn't mean you specify '@folder' to mean some folder.
Here's how it works: let's say you have a friend named Bob. So you
establish an alias for him:

     alias bob Bob <bob@xxxxxxxxxxx>

Then, because you want to keep email from him in a folder, you set up
a save-hook:

     save-hook '~f bob@xxxxxxxxxxx' +BobMail

Thereafter, you can use "@bob" as an alias for "+BobMail" (do you know
what the + in front of that means?).

To be a bit more explicit: the "@alias" notation relies on save-hooks
(and fcc-save-hooks). The "alias" keyword in your muttrc is (if you
check your manual) exclusively for defining names for email addresses.
It is not a general-purpose shorthand mechanism.

So, strictly speaking, you *could* achieve what you want by making a
"folder" alias for a garbage email address and then establishing a
save-hook for that garbage email address, like so:

     alias folder <folder-12345678909@xxxxxxxxxxx>
     save-hook '~f folder-12345678909@xxxxxxxxxxx' /home/test/mail/inbox

Thereafter, "@folder" will be considered a shortcut for
"/home/test/mail/inbox". That's going a little out of your way, I
think, but you *can* do that.

Generally, though, you *usually* don't need to specify full paths. The
easiest thing to do is to specify a $folder:

     set folder=/home/test/mail/inbox

Once you do that, you can use + or = to refer to
"/home/test/mail/inbox". Your sub-folders can even be easily referred
to when you do that. For example, with the above setting, "+BobMail"
would refer to "/home/test/mail/inboxBobMail" (note that there's no
separator between "inbox" and "BobMail", so if you want one, you need
to insert it, either at the end of $folder or in your use of the +
shortcut, like so: "+/BobMail").

~Kyle

Thanks Kyle, will give that a shot. I have an alias-file with names and e-mail-adresses, so I got kind of confused when reading about aliasing folders.

As far as the 'set folder' command goes: I'm using that already, but with an IMAP-folder on a remote server. However if I want to check mail on my local machine (old stuff I backup), I type /home/test/mail/... so I guess we're talking about two mailboxes. I've looked into establishing multiple accounts but didn't find it very clear or easy, so I thought I had found the easy way out with @folder.

- Percy