jc23,
Ok - *nix mailboxes are not multiple messages stored in multiple files scattered in multiple directories. It is a single mbox file (usually /var/mail/<account>). I believe the first thing you need to do is describe the process that gets these messages to these files in these directories.
First you asked how Sendmail used .forward files to forward a user's mail - which I answered. Then you asked , but how do I do that selectively for different directories - I got very confused. So before you describe the process that takes these messages, creates unique file names, and determines which directory to store them in based off some criteria - let me make a few assumptions:
The messages are coming from Sendmail and have not been modified in any other way
1 Message per 1 file
It is then that I would reccommend using Mail::Audit which uses MIME:Entity for MIME (your binary issue I believe) as described in this node where I asked about Email munging. Mail::Audit does not need to read in from a pipe, so it can take any array that looks like a message and re-direct it to any account you want:
# Set up your loop here
next unless open (MESSAGE, "message.file");
my @message = <MESSAGE>;
my $mail = Mail::Audit->new(data => \@message);
my $recip = 'email@address.com';
$mail->replace_header('To', $recip);
$mail->resend($recip);
next;
That should get you started if the assumptions I made were correct.
Cheers - L~R
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.