| 1 | # Copyrights 2001-2020 by [Mark Overmeer]. | ||||||||||||||||||||||||
| 2 | # For other contributors see ChangeLog. | ||||||||||||||||||||||||
| 3 | # See the manual pages for details on the licensing terms. | ||||||||||||||||||||||||
| 4 | # Pod stripped from pm file by OODoc 2.02. | ||||||||||||||||||||||||
| 5 | # This code is part of distribution Mail-Transport. Meta-POD processed with | ||||||||||||||||||||||||
| 6 | # OODoc into POD and HTML manual-pages. See README.md | ||||||||||||||||||||||||
| 7 | # Copyright Mark Overmeer. Licensed under the same terms as Perl itself. | ||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||
| 9 | package Mail::Transport::Sendmail; | ||||||||||||||||||||||||
| 10 | 1 | ▶ | use vars '$VERSION'; | ||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||
| 11 | 1 | $VERSION = '3.005'; | |||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||
| 13 | 1 | ▶ | use base 'Mail::Transport::Send'; | ||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||
| 15 | 1 | ▶ | use strict; | ||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||
| 16 | 1 | ▶ | use warnings; | ||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||
| 18 | 1 | ▶ | use Carp; | ||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||
| 21 | sub init($) | ||||||||||||||||||||||||
| 22 | 0 | ▶ | { my ($self, $args) = @_; | ||||||||||||||||||||||
|
Subroutine
init: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||
| 24 | 0 | $args->{via} = 'sendmail'; | |||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||
| 26 | 0 | ▶ | $self->SUPER::init($args) or return; | ||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||
| 28 | $self->{MTS_program} | ||||||||||||||||||||||||
| 29 | = $args->{proxy} | ||||||||||||||||||||||||
| 30 | 0 | ▶ | || $self->findBinary('sendmail') | ||||||||||||||||||||||
|
Condition0%0/5
$args->{'proxy'} || $self->findBinary('sendmail') || (return)
$args->{"proxy"} or $self->findBinary("sendmail")
MC/DC0%0/2
$args->{'proxy'} || $self->findBinary('sendmail') || (return)
$args->{"proxy"}
$self->findBinary("sendmail")
Truth table0%0/3
A or B
A= $args->{"proxy"}B= $self->findBinary("sendmail")
| |||||||||||||||||||||||||
| 31 | || return; | ||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||
| 33 | 0 | ▶ | $self->{MTS_opts} = $args->{sendmail_options} || []; | ||||||||||||||||||||||
|
Condition0%0/2
$args->{'sendmail_options'} || []
MC/DC0%0/1
$args->{'sendmail_options'} || []
$args->{'sendmail_options'}
Truth table0%0/2
A
A= $args->{'sendmail_options'}
| |||||||||||||||||||||||||
| 34 | 0 | $self; | |||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||
| 37 | #------------------------------------------ | ||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||
| 40 | sub trySend($@) | ||||||||||||||||||||||||
| 41 | 0 | ▶ | { my ($self, $message, %args) = @_; | ||||||||||||||||||||||
|
Subroutine
trySend: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||
| 43 | 0 | my $program = $self->{MTS_program}; | |||||||||||||||||||||||
| 44 | 0 | ▶ | if(open(MAILER, '|-')==0) | ||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||
| 45 | 0 | ▶ | { my $options = $args{sendmail_options} || []; | ||||||||||||||||||||||
|
Condition0%0/2
$args{'sendmail_options'} || []
MC/DC0%0/1
$args{'sendmail_options'} || []
$args{'sendmail_options'}
Truth table0%0/2
A
A= $args{'sendmail_options'}
| |||||||||||||||||||||||||
| 46 | 0 | my @to = map {$_->address} $self->destinations($message, $args{to}); | |||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||
| 48 | # {} to avoid warning about code after exec | ||||||||||||||||||||||||
| 49 | 0 | { exec $program, '-i', @{$self->{MTS_opts}}, @$options, @to; } | |||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||
| 51 | 0 | $self->log(NOTICE => "Errors when opening pipe to $program: $!"); | |||||||||||||||||||||||
| 52 | 0 | exit 1; | |||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||
| 55 | 0 | $self->putContent($message, \*MAILER, undisclosed => 1); | |||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||
| 57 | 0 | ▶ | unless(close MAILER) | ||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||
| 58 | 0 | { $self->log(NOTICE => "Errors when closing sendmail mailer $program: $!"); | |||||||||||||||||||||||
| 59 | 0 | ▶ | $? ||= $!; | ||||||||||||||||||||||
|
Condition0%0/3
$? ||= $!
MC/DC0%0/2
$? ||= $!
$?
$!
Truth table0%0/3
A ||= B
A= $?B= $!
| |||||||||||||||||||||||||
| 60 | 0 | return 0; | |||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||
| 63 | 0 | 1; | |||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||
| 66 | #------------------------------------------ | ||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||
| 68 | 1 | 1; | |||||||||||||||||||||||