line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyrights 2001-2018 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
|
|
|
1
|
|
839
|
use vars '$VERSION'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
51
|
|
11
|
|
|
|
|
|
|
$VERSION = '3.003'; |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
5
|
use base 'Mail::Transport::Send'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
88
|
|
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
16
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
17
|
|
|
|
|
|
|
|
18
|
1
|
|
|
1
|
|
4
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
481
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub init($) |
22
|
0
|
|
|
0
|
0
|
|
{ my ($self, $args) = @_; |
23
|
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
$args->{via} = 'sendmail'; |
25
|
|
|
|
|
|
|
|
26
|
0
|
0
|
|
|
|
|
$self->SUPER::init($args) or return; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
$self->{MTS_program} |
29
|
|
|
|
|
|
|
= $args->{proxy} |
30
|
0
|
|
0
|
|
|
|
|| $self->findBinary('sendmail') |
31
|
|
|
|
|
|
|
|| return; |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
0
|
|
|
|
$self->{MTS_opts} = $args->{sendmail_options} || []; |
34
|
0
|
|
|
|
|
|
$self; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
#------------------------------------------ |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub trySend($@) |
41
|
0
|
|
|
0
|
1
|
|
{ my ($self, $message, %args) = @_; |
42
|
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
|
my $program = $self->{MTS_program}; |
44
|
0
|
0
|
|
|
|
|
if(open(MAILER, '|-')==0) |
45
|
0
|
|
0
|
|
|
|
{ my $options = $args{sendmail_options} || []; |
46
|
0
|
|
|
|
|
|
my @to = map {$_->address} $self->destinations($message, $args{to}); |
|
0
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
# {} to avoid warning about code after exec |
49
|
0
|
|
|
|
|
|
{ exec $program, '-i', @{$self->{MTS_opts}}, @$options, @to; } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
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
|
0
|
|
|
|
|
unless(close MAILER) |
58
|
0
|
|
|
|
|
|
{ $self->log(NOTICE => "Errors when closing sendmail mailer $program: $!"); |
59
|
0
|
|
0
|
|
|
|
$? ||= $!; |
60
|
0
|
|
|
|
|
|
return 0; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
1; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
#------------------------------------------ |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1; |