/usr/share/perl5/Mail/Transport.pm is in libmail-box-perl 2.099-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | # Copyrights 2001-2011 by Mark Overmeer.
# For other contributors see ChangeLog.
# See the manual pages for details on the licensing terms.
# Pod stripped from pm file by OODoc 2.00.
use strict;
use warnings;
package Mail::Transport;
use vars '$VERSION';
$VERSION = '2.099';
use base 'Mail::Reporter';
use Carp;
use File::Spec;
my %mailers =
( exim => '::Exim'
, mail => '::Mailx'
, mailx => '::Mailx'
, pop => '::POP3'
, pop3 => '::POP3'
, postfix => '::Sendmail'
, qmail => '::Qmail'
, sendmail => '::Sendmail'
, smtp => '::SMTP'
);
#------------------------------------------
sub new(@)
{ my $class = shift;
return $class->SUPER::new(@_)
unless $class eq __PACKAGE__ || $class eq "Mail::Transport::Send";
#
# auto restart by creating the right transporter.
#
my %args = @_;
my $via = lc($args{via} || '')
or croak "No transport protocol provided";
$via = 'Mail::Transport'.$mailers{$via}
if exists $mailers{$via};
eval "require $via";
return undef if $@;
$via->new(@_);
}
sub init($)
{ my ($self, $args) = @_;
$self->SUPER::init($args);
$self->{MT_hostname}
= defined $args->{hostname} ? $args->{hostname} : 'localhost';
$self->{MT_port} = $args->{port};
$self->{MT_username} = $args->{username};
$self->{MT_password} = $args->{password};
$self->{MT_interval} = $args->{interval} || 30;
$self->{MT_retry} = $args->{retry} || -1;
$self->{MT_timeout} = $args->{timeout} || 120;
$self->{MT_proxy} = $args->{proxy};
if(my $exec = $args->{executable} || $args->{proxy})
{ $self->{MT_exec} = $exec;
$self->log(WARNING => "Avoid program abuse: specify an absolute path for $exec.")
unless File::Spec->file_name_is_absolute($exec);
unless(-x $exec)
{ $self->log(WARNING => "Executable $exec does not exist.");
return undef;
}
}
$self;
}
#------------------------------------------
sub remoteHost()
{ my $self = shift;
@$self{ qw/MT_hostname MT_port MT_username MT_password/ };
}
#------------------------------------------
sub retry()
{ my $self = shift;
@$self{ qw/MT_interval MT_retry MT_timeout/ };
}
#------------------------------------------
my @safe_directories
= qw(/usr/local/bin /usr/bin /bin /sbin /usr/sbin /usr/lib);
sub findBinary($@)
{ my ($self, $name) = (shift, shift);
return $self->{MT_exec}
if exists $self->{MT_exec};
foreach (@_, @safe_directories)
{ my $fullname = File::Spec->catfile($_, $name);
return $fullname if -x $fullname;
}
undef;
}
#------------------------------------------
1;
|