xf86 has asked for the wisdom of the Perl Monks concerning the following question:
The thing that I have figured out as a start to getting the messages would be...#!/usr/bin/perl -w use IO::Socket; use strict; my $EOL = "\015\012"; my $BLANK = $EOL x 1; my $username = "brice"; my $password = "mypassword"; my $count = 0; my @mailstat; my $remote = IO::Socket::INET->new( Proto => "tcp", PeerAddr => "localhost", PeerPort => "pop3(110)", ) or die "cannot connect to daytime port at localhost"; $remote->autoflush(1); print $remote "USER $username" . $BLANK; print $remote "PASS $password" . $BLANK; print $remote "QUIT" . $BLANK; while ( <$remote> ) { if (/lock busy/) { die "Session already in use!\n"; } if (/OK $username has/) { @mailstat = split(/ /); } } if ($mailstat[3] eq "0") { print "You have no messages.\n"; }
I would appriciate any help. Thanks to all the monks. Ben Ricefor ($count = $mailstat[3]; $count > 0; $count--) { print $remote "RETR $count" . $BLANK; #then do something with the data here. ???? }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Getmail perl script
by TheoPetersen (Priest) on Apr 07, 2001 at 00:21 UTC | |
|
Re: Getmail perl script
by suaveant (Parson) on Apr 07, 2001 at 00:09 UTC | |
by InfiniteSilence (Curate) on Apr 07, 2001 at 00:53 UTC | |
by suaveant (Parson) on Apr 07, 2001 at 20:38 UTC | |
|
Re: Getmail perl script
by extremely (Priest) on Apr 07, 2001 at 00:45 UTC | |
by bastard (Hermit) on Apr 07, 2001 at 02:05 UTC | |
by TheoPetersen (Priest) on Apr 07, 2001 at 23:34 UTC |