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

Re: mailboxes



El 15/Feb/06 - 23:36, Troy Piggins dijo:
> * Iván Forcada Atienza <ivan@xxxxxxxxxxxx> :
> > 
> > El 15/Feb/06 - 17:20, Troy Piggins dijo:
> > > * scwang@xxxxxxxxx <scwang@xxxxxxxxx> :
> > > > I specify mailboxes as following:
> > > > 
> > > > set folder = ~/.maildir
> > > > mailboxes =lcs
> > > > mailboxes =ml-fvwm
> [snip similar mailbox names]
> > > > 
> > > > Because I have many mailboxes in .maildir that I want
> > > > them to be specified by mailboxes directive, it's tedious
> > > > to do it as above. Does mailboxes directive support some
> > > > something like regular expression? For example, I wish I 
> > > > can specify that all mailboxes starting from 'ml' are
> > > > mailboxes as following:
> > > > 
> > > > mailboxes =ml*
> > > > 
> > > > Unfortunately, it seems mailboxes directive doesn't support
> > > > this specification currently. Is there another alternative
> > > > for this?
> > > 
> > > Try: 
> > > 
> > > mailboxes `echo ml*`
> > 
> > Yep, this works with local folders but it would be very usefull to apply
> > this to, in example, a remote imap server with hundreds of public
> > folders. It's really annoying, as you can imagin ;-). Any other
> > solution for this?
> 
> Not sure mate.  Never used imap from mutt.  And hundreds of
> mailboxes, well, I only have about 20 so wouldn't know.  For what
> it's worth, 20 is fine :-)

Wow... I've just found the way to acomplish this :-))). A simple php
script does the trick (I supose it could also be achieved with perl, but
i know nothing about perl :-().

If anybody is interested, here you have the little, improvable script ;-):
ivan@masao:~/.muttconfig$ cat getImapFolders.php
<?php
$mbox = imap_open("{imap.sampleserver.com/ssl/novalidate-cert}", "imapuser", 
"imappassword", OP_HALFOPEN|OP_READONLY)
        or die("can't connect: " . imap_last_error());

$list = imap_getmailboxes($mbox, "{imap.sampleserver.com}", "*");
sort($list);
if (is_array($list))
{
        foreach ($list as $key => $val)
                echo str_replace( "{imap.sampleserver.com}INBOX", "", 
imap_utf7_decode($val->name) ) . " ";
}
else
{
        echo "imap_getmailboxes failed: " . imap_last_error() . "\n";
}

imap_close($mbox);
?>

Of course, you need a working php-imap extension.
Finally, something like:
mailboxes `php ~/.muttconfig/getImapFolders.php | tr '.' '='`
 sould be added to your .muttrc

Hope it helps anybody :-)

> Sorry couldn't help.
> 
> -- 
> Troy Piggins
> Ubuntu 5.10  pkgs : kernel 2.6.12-9-386, postfix 2.2.4, procmail 3.22
> Compiled from src : slrn 0.9.8.1/rt (score_color patch), mutt 1.5.11i
>                       vim 6.4
> 

-- 
___________________________________________________________________
Iván Forcada Atienza:
  correo: ivan@xxxxxxxxxxxx
-------------------------------------------------------------------
"Software is like sex: it's better when it's free" (Linus Torvalds)
  

Attachment: pgp6qjSySlVoe.pgp
Description: PGP signature