30 my $pops = Net::POP3->new($opt_s->addr) 31 or die "Failed to connect to POP3 server: $!\n"; 32 33 $pops->login($opt_u, $opt_p) 34 or die "Authentication failed\n"; 35 36 my $fh = new_tmpfile IO::File 37 or die "Cannot create temporary file: $!\n"; 38 39 $pops->get($opt_m, $fh) 40 or die "No such message $opt_m\n"; 41 42 $pops->quit(); 43 $pops = undef; 44 45 $fh->seek(0, SEEK_SET);
Example 1: Using Net::POP3 to read the message.