> I've been using Mutt for a few weeks. I'm impressed with the amount
> of flexibility that Mutt offers, and for the most part, I've been
> successful in adapting Mutt to my personal tastes. But there's one
> thing that I haven't been able to get quite right, and I'm hoping one
> of you can offer some insight.
>
> I use Mutt with three different IMAP accounts. In general, I'd like
> Mutt to save messages in ~/mail/messages. BUT, when using one
> particular IMAP account (call it "imaps://mail.example.com"), I'd like
> the default save folder to be imaps://mail.example.com/messages
> instead.
>
> Put it another way, I'd the default save folder to be "=messages",
> relative to the current value of $folder.
>
> I've tried to do this with a combination of folder and save hooks.
>
> My default folder-hook is
>
> folder-hook . 'set folder="~/mail"; \
> set record="~/mail/messages"; \
> set postponed="~/mail/postponed-msgs"; \
> set smtp_url= ... ; \
> set ssl_starttls=yes; \
> set from= ... ; \
> set pgp_sign_as= ...;'
>
> (Above, "..." isn't a literal string -- it just means that I've
> omitted the value, since the setting doesn't seem relevant to the
> discussion at hand.)
>
> The folder-hook for the IMAP account where I'd like to have the save
> folder on the IMAP server.
>
> folder-hook imaps://me@xxxxxxxxxxxxxxxx \
> 'set folder=imaps://me@xxxxxxxxxxxxxxxx/; \
> set record=imaps://me@xxxxxxxxxxxxxxxx/messages; \
> set smtp_url=smtp://me@xxxxxxxxxxxxxxxx; \
> set from= ...; \
> set pgp_sign_as=...'
>
> Finally, I have one save hook:
>
> save-hook . =messages
>
>
> This _almost_ works. If I'm *not* reading mail at
> imaps://mail.example.com/, mutt offers the save folder:
>
> Save to mailbox ('?' for list): =messages
>
> which appends to ~/mail/messages. This is exactly what I'd like Mutt
> to do.
>
>
> When I read mail at imaps://mail.example.com/, Mutt offers the
> following:
>
> Save to mailbox ('?' for list): ~/mail/messages
>
> If I change the line to
>
> Save to mailbox: =messages
>
> Then mutt appends saved messages to imaps://mail.example.com/messages.
>
> Before giving the "save" command, I've verified that
> folder=imaps://mail.example.com/.
>
>
> When reading mail at imaps://mail.example.com, how can I get Mutt to
> offer "=messages" as the default save folder, instead of
> "~/mail/messages"? I'm sure it's something simple, but I'm just not
> seeing it.
I found a way to get the behavior I was looking for: move the
save-hook into the individual folder hooks:
folder-hook . 'set folder="~/mail"; \
set record="~/mail/messages"; \
set postponed="~/mail/postponed-msgs"; \
set smtp_url= ... ; \
set ssl_starttls=yes; \
set from= ... ; \
set pgp_sign_as= ...; \
save-hook . =messages' ## new line
folder-hook imaps://me@xxxxxxxxxxxxxxxx \
'set folder=imaps://me@xxxxxxxxxxxxxxxx/; \
set record=imaps://me@xxxxxxxxxxxxxxxx/messages; \
set smtp_url=smtp://me@xxxxxxxxxxxxxxxx; \
set from= ...; \
set pgp_sign_as=...; \
save-hook . =messages ' ## new line
# save-hook . =messages ## remove this line
To give credit where credit is due, I got the idea from
<http://zeniv.linux.org.uk/~telsa/BitsAndPieces/muttrc-1.2>.
Steve
Attachment:
pgpkz5ZHBAMFP.pgp
Description: PGP signature