Mail-Box-IMAP4-SSL

 view release on metacpan or  search on metacpan

META.json  view on Meta::CPAN

            "IPC::Open3" : "0",
            "Pod::Coverage::TrustPod" : "0",
            "Test::CPAN::Meta" : "0",
            "Test::More" : "0",
            "Test::Pod" : "1.41",
            "Test::Pod::Coverage" : "1.08"
         }
      },
      "runtime" : {
         "requires" : {
            "IO::Socket::SSL" : "1.12",
            "Mail::Box::IMAP4" : "2.079",
            "Mail::IMAPClient" : "3.02",
            "Mail::Reporter" : "2.079",
            "Mail::Transport::IMAP4" : "2.079",
            "perl" : "5.006",
            "strict" : "0",
            "superclass" : "0",
            "warnings" : "0"
         }
      },

META.yml  view on Meta::CPAN

    - xt
    - examples
    - corpus
  package:
    - DB
provides:
  Mail::Box::IMAP4::SSL:
    file: lib/Mail/Box/IMAP4/SSL.pm
    version: 0.03
requires:
  IO::Socket::SSL: 1.12
  Mail::Box::IMAP4: 2.079
  Mail::IMAPClient: 3.02
  Mail::Reporter: 2.079
  Mail::Transport::IMAP4: 2.079
  perl: 5.006
  strict: 0
  superclass: 0
  warnings: 0
resources:
  bugtracker: https://github.com/dagolden/Mail-Box-IMAP4-SSL/issues

Makefile.PL  view on Meta::CPAN

  "AUTHOR" => "David Golden <dagolden\@cpan.org>",
  "BUILD_REQUIRES" => {},
  "CONFIGURE_REQUIRES" => {
    "ExtUtils::MakeMaker" => "6.17"
  },
  "DISTNAME" => "Mail-Box-IMAP4-SSL",
  "EXE_FILES" => [],
  "LICENSE" => "apache",
  "NAME" => "Mail::Box::IMAP4::SSL",
  "PREREQ_PM" => {
    "IO::Socket::SSL" => "1.12",
    "Mail::Box::IMAP4" => "2.079",
    "Mail::IMAPClient" => "3.02",
    "Mail::Reporter" => "2.079",
    "Mail::Transport::IMAP4" => "2.079",
    "strict" => 0,
    "superclass" => 0,
    "warnings" => 0
  },
  "TEST_REQUIRES" => {
    "ExtUtils::MakeMaker" => 0,

Makefile.PL  view on Meta::CPAN

    "TESTS" => "t/*.t"
  }
);


my %FallbackPrereqs = (
  "ExtUtils::MakeMaker" => 0,
  "File::Spec" => "0.86",
  "File::Spec::Functions" => 0,
  "IO::CaptureOutput" => "1.06",
  "IO::Socket::SSL" => "1.12",
  "List::Util" => 0,
  "Mail::Box::IMAP4" => "2.079",
  "Mail::Box::Manager" => 0,
  "Mail::IMAPClient" => "3.02",
  "Mail::Reporter" => "2.079",
  "Mail::Transport::IMAP4" => "2.079",
  "Probe::Perl" => "0.01",
  "Proc::Background" => "1.08",
  "Test::More" => "0.74",
  "strict" => 0,

README  view on Meta::CPAN

         my $mbm = Mail::Box::Manager->new;
         $mbm->registerType( imaps => 'Mail::Box::IMAP4::SSL' );
 
         my $inbox = $mbm->open(
             folder => 'imaps://johndoe:wbuaqbr@imap.example.com/INBOX',
         );

DESCRIPTION
    This is a thin subclass of Mail::Box::IMAP4 to provide IMAP over SSL
    (aka IMAPS). It hides the complexity of setting up Mail::Box::IMAP4 with
    IO::Socket::SSL, Mail::IMAPClient and Mail::Transport::IMAP4.

    In all other respects, it resembles Mail::Box::IMAP4. See that module
    for documentation.

INHERITANCE
         Mail::Box::IMAP4::SSL
           is a Mail::Box::IMAP4
           is a Mail::Box::Net
           is a Mail::Box
           is a Mail::Reporter

cpanfile  view on Meta::CPAN

requires "IO::Socket::SSL" => "1.12";
requires "Mail::Box::IMAP4" => "2.079";
requires "Mail::IMAPClient" => "3.02";
requires "Mail::Reporter" => "2.079";
requires "Mail::Transport::IMAP4" => "2.079";
requires "perl" => "5.006";
requires "strict" => "0";
requires "superclass" => "0";
requires "warnings" => "0";

on 'test' => sub {

lib/Mail/Box/IMAP4/SSL.pm  view on Meta::CPAN

use 5.006;
use strict;
use warnings;

package Mail::Box::IMAP4::SSL;
# ABSTRACT: handle IMAP4 folders with SSL
our $VERSION = '0.03'; # VERSION

use superclass 'Mail::Box::IMAP4' => 2.079;
use IO::Socket::SSL 1.12;
use Mail::Reporter 2.079 qw();
use Mail::Transport::IMAP4 2.079 qw();
use Mail::IMAPClient 3.02;

my $imaps_port = 993; # standard port for IMAP over SSL

#--------------------------------------------------------------------------#
# init
#--------------------------------------------------------------------------#

lib/Mail/Box/IMAP4/SSL.pm  view on Meta::CPAN

            Mail::Reporter->log( ERROR => "The '$req' option is required for " . __PACKAGE__ );
            return;
        }
    }

    # trying to create the transport object

    my $verify_mode =
      $ENV{MAIL_BOX_IMAP4_SSL_NOVERIFY} ? SSL_VERIFY_NONE() : SSL_VERIFY_PEER();

    my $ssl_socket = IO::Socket::SSL->new(
        Proto           => 'tcp',
        PeerAddr        => $args->{server_name},
        PeerPort        => $args->{server_port},
        SSL_verify_mode => $verify_mode,
    );

    unless ($ssl_socket) {
        Mail::Reporter->log( ERROR => "Couldn't connect to '$args->{server_name}': "
              . IO::Socket::SSL::errstr() );
        return;
    }

    my $imap = Mail::IMAPClient->new(
        User     => $args->{username},
        Password => $args->{password},
        Socket   => $ssl_socket,
        Uid      => 1,                # Mail::Transport::IMAP4 does this
        Peek     => 1,                # Mail::Transport::IMAP4 does this
    );

lib/Mail/Box/IMAP4/SSL.pm  view on Meta::CPAN

     $mbm->registerType( imaps => 'Mail::Box::IMAP4::SSL' );
 
     my $inbox = $mbm->open(
         folder => 'imaps://johndoe:wbuaqbr@imap.example.com/INBOX',
     );

=head1 DESCRIPTION

This is a thin subclass of L<Mail::Box::IMAP4> to provide IMAP over SSL (aka
IMAPS).  It hides the complexity of setting up Mail::Box::IMAP4 with
L<IO::Socket::SSL>, L<Mail::IMAPClient> and L<Mail::Transport::IMAP4>.

In all other respects, it resembles L<Mail::Box::IMAP4>.  See that module
for documentation.

=for Pod::Coverage init

=head1 INHERITANCE

     Mail::Box::IMAP4::SSL
       is a Mail::Box::IMAP4

t/00-report-prereqs.t  view on Meta::CPAN

use File::Spec::Functions;
use List::Util qw/max/;

my @modules = qw(
  CPAN::Meta
  CPAN::Meta::Requirements
  ExtUtils::MakeMaker
  File::Spec
  File::Spec::Functions
  IO::CaptureOutput
  IO::Socket::SSL
  List::Util
  Mail::Box::IMAP4
  Mail::Box::Manager
  Mail::IMAPClient
  Mail::Reporter
  Mail::Transport::IMAP4
  Probe::Perl
  Proc::Background
  Test::More
  perl

t/bin/imapd.pl  view on Meta::CPAN

#!/usr/bin/env perl
use strict;
use warnings;
use IO::Socket::SSL;
use File::Spec;

die unless @ARGV == 3;
my $server_port = shift @ARGV;
my ( $username, $password ) = map { quotemeta $_ } @ARGV;

my $server = IO::Socket::SSL->new(
    LocalAddr     => '127.0.0.1',
    LocalPort     => $server_port,
    Proto         => 'tcp',
    ReuseAddr     => 1,
    Listen        => 2,
    SSL_key_file  => File::Spec->catfile(qw/t certs server-key.pem/),
    SSL_cert_file => File::Spec->catfile(qw/t certs server-cert.pem/),
) or die "Couldn't listen: " . IO::Socket::SSL::errstr() . "\n";

while ( my $client = $server->accept() ) {
    local $/ = "\r\n";
    print {$client} "* OK IMAP4rev1 server ready\r\n";
    chomp( my $response = <$client> );
    $response =~ s{^(\S+)\s+}{}xms;
    my $cid = $1 || q{*};
    if ( $response =~ m{^LOGIN \s+ "?$username"? \s+ "?$password"?}xms ) {
        print {$client} "$cid OK LOGIN Completed\r\n";
    }



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