#!/usr/bin/perl -w
# vim: set sw=4 ts=4 si et:
# Copyright: GPL, Author: Guido Socher
# $Revision: $, last changed: $Date: $
sub help(){
    print "poptest -- test the installation of Mail::POP3Client
and the connection the local ipop3 daemon.

USAGE: poptest username password

The program lists all messages with From and Subject together with some
debug information if the connection is successfult. It connects to the
pop3d on localhost.
This test is a prerequiste for lfwmail to work.
";
 exit 0;
}
help() unless($ARGV[1]);
#
use Mail::POP3Client;
my $pop = new Mail::POP3Client( USER     => $ARGV[0],
                             PASSWORD => $ARGV[1],
                             HOST     => "localhost",
                             DEBUG     => 1);

my $cnt;
$cnt=$pop->Count();
die("\nAuthentication error. Msg count: $cnt\n") unless($cnt >=0);

for( $i = 1; $i <= $cnt; $i++ ) {
  foreach( $pop->Head( $i ) ) {
    /^(From|Subject):\s+/i && print $_, "\n";
  }
}
$pop->Close();

__END__ 

