| Category: | E-Mail Programs |
| Author/Contact Info | haptor@op.pl #perl @ ircnet.pl |
| Description: | I wrote (for me) nice script I use it always when i want to check mail.... i hope that somebody use this script and write me about it. Maybe you see some bad moves, or something.... tha n write in reply... I have to learn perl always and everywhere. Please comment this source |
#!/usr/bin/perl
use warnings;
use strict;
use Net::POP3;
use Tie::File;
tie my @file, "Tie::File", "dane";
if ($#file != 2){
print "Write pop3 server adress:\n";
chomp($file[0] = <STDIN>);
print "Write login:\n";
chomp($file[1] = <STDIN>);
print "Write password:\n";
chomp($file[2] = <STDIN>);
}
my $time = scalar localtime;
my $pop = Net::POP3->new($file[0]);
my $res = $pop->login($file[1], $file[2]);
if ($res){
print"On $time e-mail status inbox: $res post \n";
} else {
print "Couldn't connect $!\n";
exit;
}
my $msg; my $msgnum;
do{
print "Write id(number) email to read subject:\n";
chomp($msgnum = <STDIN>);
} while($msgnum > $res);
$msg = $pop->get($msgnum);
for my $line ( @$msg ) {
if( $line =~ /^Subject:(.*)/ ) {
print "Subject is $1\n";
last
} }
print "Read e-mail? [y/n]\n";
chomp(my $ans = <STDIN>);
if ($ans =~ /y/i){
while( my $line = shift @$msg ) {
last while $line =~ /^Status:/;
}
my $nline = 0;
for( @$msg )
{
$nline += 1;
print "$nline> $_";
} } elsif ($ans =~ /n/i){
exit;
} else {
print "Bad!";
exit;
}
$pop->quit();
|
|
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: POP3 client - end
by Discipulus (Canon) on Dec 05, 2005 at 08:59 UTC | |
by Happy-the-monk (Canon) on Dec 05, 2005 at 09:12 UTC | |
by w3b (Beadle) on Dec 05, 2005 at 12:37 UTC | |
by w3b (Beadle) on Dec 05, 2005 at 14:54 UTC | |
by Discipulus (Canon) on Dec 06, 2005 at 13:05 UTC |