deadpickle has asked for the wisdom of the Perl Monks concerning the following question:
UPDATE: Replacing the open command with my $folder = $mgr->open(folder => $mailspool, access => 'rw'); give write access the the folder and then you can delete it... but I can only do it as root. I "ls" the mail folder and got: -rw------- 1 jlahowet mail 3523 May 27 00:48 jlahowet. If I read this right, I own the file so I'm not sure why I have to be root to delete it.#!/usr/bin/perl -w use strict; use Mail::Box::Manager; my $mailspool = "/var/spool/mail/jlahowet"; my $received = "/home/jlahowet/THOR/HAS/messages"; my $mgr = Mail::Box::Manager->new; my $folder = $mgr->open(folder => $mailspool); my $type = $folder->type; print "$type\n"; my $name = $folder->name; print "$name\n"; my $emails = $folder->messages; print "$emails\n"; foreach my $message ($folder->messages) { print $message->get('Subject') || '<no subject>', "\n"; $message->delete; } $folder->close; exit;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Mail::Box-deleting messages
by FloydATC (Deacon) on May 27, 2009 at 05:46 UTC | |
|
Re: Mail::Box-deleting messages
by jethro (Monsignor) on May 27, 2009 at 08:38 UTC |