On 12 Aug 2002 18:54:27 +0200, [EMAIL PROTECTED] (Petre Agenbag)
wrote:

> checks through the files in the particular mailbox, grabs the
>From: address, and mails back with an appropriate message. Sure, you
>will have to keep track of which messages was handled already, but that
>can't be too difficult right?
>
>Only problem, I'm a total beginner with Perl, I only KNOW this must be
>possible.
>

Try the module Mail::MboxParser.
Put your user's mbox in there where "Mboxtest' is. 
You can easily test the "from" information, push the
body into an array, and mail it off to your customer.

Read the modules perldoc page for all the fields you can get.

#####################################################################
#!/usr/bin/perl
use Mail::MboxParser;

my $mb = Mail::MboxParser->new('Mboxtest', decode => 'ALL');

# slurping
for my $msg ($mb->get_messages) {
print "###########################################################\n";
print $msg->header->{subject}, "\n";
print $msg->header->{from}, "\n";
print "###########################################################\n";
#$msg->store_all_attachments('tmp');
my ($body) = $msg->body($msg->find_body,0);
print ($body->as_string);
print "###########################################################\n";
}
print "############################################################\n";
print "############################################################\n";
print "############################################################\n";

# we forgot to do something with the messages
$mb->rewind;
while (my $msg = $mb->next_message) {
# iterate again
# ...
}
exit;
###################################################################


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to