line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyrights 2001-2019 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::Exim; |
10
|
1
|
|
|
1
|
|
879
|
use vars '$VERSION'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
43
|
|
11
|
|
|
|
|
|
|
$VERSION = '3.004'; |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
5
|
use base 'Mail::Transport::Send'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
347
|
|
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
15
|
|
16
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
17
|
|
17
|
|
|
|
|
|
|
|
18
|
1
|
|
|
1
|
|
4
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
305
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub init($) |
22
|
0
|
|
|
0
|
0
|
|
{ my ($self, $args) = @_; |
23
|
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
$args->{via} = 'exim'; |
25
|
|
|
|
|
|
|
|
26
|
0
|
0
|
|
|
|
|
$self->SUPER::init($args) or return; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
$self->{MTS_program} |
29
|
|
|
|
|
|
|
= $args->{proxy} |
30
|
0
|
|
0
|
|
|
|
|| ( -x '/usr/sbin/exim4' ? '/usr/sbin/exim4' : undef) |
31
|
|
|
|
|
|
|
|| $self->findBinary('exim', '/usr/exim/bin') |
32
|
|
|
|
|
|
|
|| return; |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
$self; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
#------------------------------------------ |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub trySend($@) |
41
|
0
|
|
|
0
|
1
|
|
{ my ($self, $message, %args) = @_; |
42
|
|
|
|
|
|
|
|
43
|
0
|
|
0
|
|
|
|
my $from = $args{from} || $message->sender; |
44
|
0
|
0
|
0
|
|
|
|
$from = $from->address if ref $from && $from->isa('Mail::Address'); |
45
|
0
|
|
|
|
|
|
my @to = map {$_->address} $self->destinations($message, $args{to}); |
|
0
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
my $program = $self->{MTS_program}; |
48
|
0
|
0
|
|
|
|
|
if(open(MAILER, '|-')==0) |
49
|
0
|
|
|
|
|
|
{ { exec $program, '-i', '-f', $from, @to; } # {} to avoid warning |
|
0
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
$self->log(NOTICE => "Errors when opening pipe to $program: $!"); |
51
|
0
|
|
|
|
|
|
exit 1; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
$self->putContent($message, \*MAILER, undisclosed => 1); |
55
|
|
|
|
|
|
|
|
56
|
0
|
0
|
|
|
|
|
unless(close MAILER) |
57
|
0
|
|
|
|
|
|
{ $self->log(ERROR => "Errors when closing Exim mailer $program: $!"); |
58
|
0
|
|
0
|
|
|
|
$? ||= $!; |
59
|
0
|
|
|
|
|
|
return 0; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
1; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
#------------------------------------------ |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
1; |