stephan has asked for the wisdom of the Perl Monks concerning the following question: (mail and news)

if i have a global mailbox on a mail server (eg. all mail to that domain gets dumped into one mailbox) and i download this mailbox from the server (to a remote dialup mail server), is there a way (or an existing script) to break the one large mailbox into the different mailboxes and distributing it on the local system?

Originally posted as a Categorized Question.

  • Comment on getting a global mailbox and splitting it up

Replies are listed 'Best First'.
Re: getting a global mailbox and splitting it up
by nuance (Hermit) on Jul 16, 2000 at 04:37 UTC

    I do exactly this, but I use the mail system to do it (i.e. you don't need a perl script). I have found qmail to be perfectly suited to this task. Qmail will allow any user to control an entire domain or even several domains. I use a script called qmtppull that gets mail from a remote mailbox and injects it into the local mail system, where it gets delivered normally.

    This isn't really a perl answer, but sometimes there are better ways to do it and I think that this is one of them. I brought this up because I was going to try doing this job with perl, but found (in my case anyway) a better way.

Re: getting a global mailbox and splitting it up
by lhoward (Vicar) on Jul 16, 2000 at 02:16 UTC
    Depends how you want to do it. I personally use fetchmail in conjunction with some procmail rules to get mail from a single remore mailbox and deliver it into multiple local mailboxes. You could do the same yourself in perl using the Net::POP3 module for retrieval and Net::SMTP for local delivery. There are other alternatives too.