Mail-POP3Client

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN


2.19 2013/19/03
        + RT82713 - version number contains a space.

2.18 2008/02/11
	+ update message ID regular expression for Dovecot APOP authentication.
	+ Allow calling scripts to set $\ without negative affects.

2.17 2005/08/19
	+ undef $me->{SOCKET} on close.
	+ Check $@ after eval of require IO::Socket::SSL

2.16 2004/03/13
	+ Correct documentation errors for Connect().
	+ Fix problem with servers not returning an empty line after 
	  headers when message body is blank.

2.15 2003/10/17
	+ Create a method to set AuthMode (Jamie Le Tual)
	+ Force Mime::Base64::encode base64 result into a single line
	  (Jamie Le Tual)

FAQ  view on Meta::CPAN

authentication.  The servers I have tested against do not appear to do
this.

Another possibility that has been suggested is a situation with
redundant POP servers using DNS round robin.  If the first address
IO::Socket connects to is down, the module will fail to connect.


7. How do I use an SSL connection?  (Thanks to Jamie LeTual)

my $socket = IO::Socket::SSL->new( PeerAddr => 'pop.host.com',
				   PeerPort => 993,
				   Proto    => 'tcp') || die "Ack! No socket!";
my $pop = Mail::POP3Client->new();
$pop->User('jamie');
$pop->Pass('secret');
$pop->Socket($socket);
$pop->Connect();

lib/Mail/POP3Client.pm  view on Meta::CPAN

  $host and $me->Host($host);
  $port and $me->Port($port);

  $me->Close();

  my $s = $me->{SOCKET};
  $s || do {
    if ( $me->{USESSL} ) {
      if ( $me->Port() == 110 ) { $me->Port( 995 ); }
        eval {
	  require IO::Socket::SSL;
	};
      $@ and $me->Message("Could not load IO::Socket::SSL: $@") and return 0;
      $s = IO::Socket::SSL->new( PeerAddr => $me->Host(),
				 PeerPort => $me->Port(),
				 Proto    => "tcp",
				 Type      => SOCK_STREAM,
				 LocalAddr => $me->LocalAddr(),
				 Timeout   => $me->{TIMEOUT} )
	or $me->Message( "could not connect SSL socket [$me->{HOST}, $me->{PORT}]: $!" )
	  and return 0;
      $me->{SOCKET} = $s;
      
    } else {

lib/Mail/POP3Client.pm  view on Meta::CPAN

			     );

  # OR
  $pop2 = new Mail::POP3Client( HOST  => "pop3.otherdo.main" );
  $pop2->User( "somebody" );
  $pop2->Pass( "doublesecret" );
  $pop2->Connect() >= 0 || die $pop2->Message();
  $pop2->Close();

  # OR to use your own SSL socket...
  my $socket = IO::Socket::SSL->new( PeerAddr => 'pop.securedo.main',
                                     PeerPort => 993,
                                     Proto    => 'tcp') || die "No socket!";
  my $pop = Mail::POP3Client->new();
  $pop->User('somebody');
  $pop->Pass('doublesecret');
  $pop->Socket($socket);
  $pop->Connect();

=head1 DESCRIPTION

lib/Mail/POP3Client.pm  view on Meta::CPAN

The same applies to CRAM-MD5, too.

If you enable debugging with DEBUG => 1, socket traffic will be echoed
to STDERR.

Another warning, it's impossible to differentiate between a timeout
and a failure.

If you pass a true value for USESSL, the port will be changed to 995 if
it is not set or is 110.  Otherwise, it will use your port.  If USESSL
is true, IO::Socket::SSL will be loaded.  If it is not in your perl,
the call to connect will fail.

new returns a valid Mail::POP3Client object in all cases.  To test for
a connection failure, you will need to check the number of messages:
-1 indicates a connection error.  This will likely change sometime in
the future to return undef on an error, setting $! as a side effect.
This change will not happen in any 2.x version.

=item I<Head>( MESSAGE_NUMBER [, PREVIEW_LINES ] )



( run in 0.560 second using v1.01-cache-2.11-cpan-4d50c553e7e )