[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fwd: Probably an easy problem...



Wow, that cpan tool is pretty damn cool. Thanks for all the help, everything is working just the way I wanted it.

Ken

On 11/9/06, Paul Nicholas McCubbins <nick77@dtnspeed.net> wrote:
I'm glad it (almost) works for you.

You're missing the Mail::POP3Client perl module/package.  It's not a
module that's included in Perl by default.  The package is called
Mail-POP3Client on gentoo.  If it's not in yum (sorry, I don't know
about Suse/Redhat's package management), you can use Perl's "cpan"
command to install it:

# cpan -i Mail::POP3Client

the "cpan" command will download and install the package automatically
(cpan also has a remove function).  You may also need to install
MIME-tools.

CPAN has a web-based search engine at http://search.cpan.org.

On Thu, 2006-11-09 at 13:07 -0600, Ken Keefe wrote:
> Yeah, that is exactly the type of thing I'm looking for Paul. However
> it is giving me an error about (I think) a missing library. I did a
> yum install "perl-Mail*", but it didn't put the POP3Client.pm anywhere
> on my system. How should I get this library? Here is the error:
>
> Can't locate Mail/POP3Client.pm in @INC (@INC contains:
> /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi
>
> I tweaked your code a little because I don't care about what is in the
> subject or anything like that, I just want any attachments the account
> receives (it won't be accessible from outside our network). The
> modified version:
>
> #!/usr/bin/perl
>
> # Written by Nick McCubbins, claws962001@yahoo.com
> # 11/9/06
>
> use Mail::POP3Client;
> use MIME::Parser;
> use strict;
>
> my $_MAILHOST="I filled this in";
> my $_USER="I filled this in"; #username
> my $_PASS="I filled this in"; #password
>
> my $_OUTDIR="/I/filled/this/in/"; #Output attachments here
>
> my $i = 0;
> my $parser = new MIME::Parser;
> my $pop = new Mail::POP3Client( HOST      =>$_MAILHOST,
>                                 USER      =>$_USER,
>                                 PASSWORD  =>$_PASS,
>                                 DEBUG     =>0 );
> $parser->output_dir( $_OUTDIR );
>
>
> if( $pop->Count() < 0 ) {
>    die "Error accessing POP mailbox";
> }
>
> for( $i = 0; $i <= $pop->Count(); $i++ ) {
>     my $wholeBody = $pop->HeadAndBody( $i );
>     my $entity = $parser->parse_data( $wholeBody );
> }
>
> Thanks so much for helping me out. This is making me wonder if I
> should finally learn perl... I know PHP for web apps and BASH for
> shell scripts, but this is a shining example of what is missing from
> that equation.
>
> Ken
>
>
> On 11/9/06, Paul Nicholas McCubbins < nick77@dtnspeed.net> wrote:
> > Tell me if this might fit your needs:
> >
> >
> > On Thu, 2006-11-09 at 08:28 -0600, Ken Keefe wrote:
> > > Anyone alive out there?
> > >
> > > Ken
> > >
> > > ---------- Forwarded message ----------
> > > From: Ken Keefe <kjkeefe@gmail.com>
> > > Date: Nov 7, 2006 10:21 AM
> > > Subject: Probably an easy problem...
> > > To: discuss@silug.org
> > >
> > > Here's the scenario, hopefully you guys can help me or at least point
> > > me in the right direction...
> > >
> > > I have an email account that is emailed pdf files on a regular basis
> > > and I want to have my linux box automatically (let's say, every hour)
> > > download that email and save the attachments to a directory (let's
> > > say, ~/reports/). I don't care about the body or anything else
> > > regarding the email, I just need to save the attachment. Any
> > > thoughts?
> > >
> > > I have been trying to get fetchmail to do this for me, but I am having
> > > a little trouble. I feel like this is going to be a one line command,
> > > but I am just missing a piece of the puzzle.
> > >
> > > Thanks in advance for the help.
> > >
> > > Ken
> > --
> > Paul Nicholas McCubbins < nick77@dtnspeed.net>
> > PGP fingerprint E144 28C3 F5B2 3630 AC88  8750 F1CA 7A3C E030 E8B9
> >
> >
> >
>
--
Paul Nicholas McCubbins < nick77@dtnspeed.net>
PGP fingerprint E144 28C3 F5B2 3630 AC88  8750 F1CA 7A3C E030 E8B9