#!/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();

In reply to POP3 client - end by w3b

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.