Skip to content

Commit

Permalink
check for IO::Socket::SSL
Browse files Browse the repository at this point in the history
  • Loading branch information
msimerson committed Mar 25, 2024
1 parent 56bf600 commit e6df3b8
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions lib/Mail/DMARC/Report/Receive.pm
Expand Up @@ -29,11 +29,18 @@ sub from_imap {
my $f_done = $self->config->{imap}{f_done};
my $port = $self->config->{imap}{port} // 993;

if (defined $self->config->{imap}{SSL_verify_mode}) {
IO::Socket::SSL::set_ctx_defaults(
SSL_verifycn_scheme => 'imap',
SSL_verify_mode => $self->config->{imap}{SSL_verify_mode},
);
if ($port != 143) {
eval "use IO::Socket::SSL"; ## no critic (Eval)
if ( $@ ) {
croak "Can't load IO::Socket::SSL: $!\n";
};

if (defined $self->config->{imap}{SSL_verify_mode}) {
IO::Socket::SSL::set_ctx_defaults(
SSL_verifycn_scheme => 'imap',
SSL_verify_mode => $self->config->{imap}{SSL_verify_mode},
);
}
}

no warnings qw(once); ## no critic (Warn)
Expand Down

0 comments on commit e6df3b8

Please sign in to comment.