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

Re: IMAP Subdirectories in sidebar



Hi Nathan!

On Thu, 10 Apr 2008, Nathan Huesken wrote:

> Hi,
> 
> I am using IMAP with subdirectories (for my different mailboxes) and 
> switch throught them using the sidebar addon.
> I tell imap with the "mailbox" commands about the subdirectories:
> 
> mailboxes =INBOX =INBOX/mutt ...
> 
> But since I am constantly adding new mail-addresses and removing old 
> ones, I am wondering if it is possinle to setup mutt so that it 
> searches for sub directories and displayes them in the sidebar 
> without me telling in the "mailnoxes" line.
> Something like:
> 
> mailboxes =INBOX =INBOX/.*
> 
> (I hope you get the idea).

I believe not. But you can create the mailboxes dynamically using 
backticks. (See http://wiki.mutt.org/?ConfigTricks). I have once 
created a perl script, that lists all mailboxes when called:

,----
| #!/usr/bin/perl 
| 
| use Net::IMAP::Simple; 
| 
| my $password=""; 
| my $user="user"; 
| my $host="hostname"; 
| my $seperator="."; 
| 
| my $imap = Net::IMAP::Simple->new($host) || 
| die $Net::IMAP::Simple::errstr."\n"; 
| unless($imap->login($user, $password)){ 
|     die "Login failed: " . $imap->errstr() . "\n"; 
| } 
| my @mb; 
| push @mb,sort($imap->mailboxes); 
| 
| foreach (@mb){ 
|     s/^/=/; 
|     s|/|$seperator|g; 
|     print "$_ "; 
| }; 
| print "\n"; 
| 
| $imap->quit; 
`----

There might be better ways, to write such a script, I only do it
occasionally. But I am not using it anymore, cause I don't care for
certain folders (e.g. spam, sent, draft...)

The only problem is, that this will only be triggered, when you source 
your muttrc (e.g. start mutt), though you could probably get around this, 
by using hooks. 

> 
> I am also wondering if it is possible to create and delete 
> Mailboxes/subdirectories in mutt?

Yes, open the mailbox view (at the change-folder prompt, press ?).  
There you can create new folders with C and delete Folders with d. If 
unsure press ? and look at the help.


regards,
Christian
-- 
When the speaker and he to whom he is speaks do not understand, that is
metaphysics.
                -- Voltaire