line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Email::Send::Qmail; |
2
|
2
|
|
|
2
|
|
1620
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
76
|
|
3
|
|
|
|
|
|
|
|
4
|
2
|
|
|
2
|
|
11
|
use File::Spec (); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
77
|
|
5
|
|
|
|
|
|
|
BEGIN { |
6
|
2
|
|
|
2
|
|
4
|
local $Return::Value::NO_CLUCK = 1; |
7
|
2
|
|
|
|
|
11
|
require Return::Value; |
8
|
2
|
|
|
|
|
108
|
Return::Value->import; |
9
|
|
|
|
|
|
|
} |
10
|
2
|
|
|
2
|
|
10
|
use Symbol qw(gensym); |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
105
|
|
11
|
|
|
|
|
|
|
|
12
|
2
|
|
|
2
|
|
10
|
use vars qw[$QMAIL $VERSION]; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
675
|
|
13
|
|
|
|
|
|
|
$QMAIL ||= q[qmail-inject]; |
14
|
|
|
|
|
|
|
$VERSION = '2.199'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub is_available { |
17
|
1
|
|
|
1
|
0
|
3
|
my $class = shift; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
1
|
50
|
|
|
|
4
|
return failure "No qmail found" unless $class->_find_qmail; |
21
|
0
|
|
|
|
|
0
|
return success; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub _find_qmail { |
25
|
1
|
|
|
1
|
|
3
|
my $class = shift; |
26
|
|
|
|
|
|
|
|
27
|
1
|
|
|
|
|
4
|
my $sendmail; |
28
|
|
|
|
|
|
|
|
29
|
1
|
50
|
|
|
|
24
|
if (-x $QMAIL) { |
30
|
0
|
|
|
|
|
0
|
return $QMAIL; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
1
|
|
|
|
|
28
|
for my $dir (File::Spec->path) { |
34
|
7
|
50
|
|
|
|
825
|
if ( -x "$dir/$QMAIL" ) { |
35
|
0
|
|
|
|
|
0
|
$sendmail = "$dir/$QMAIL"; |
36
|
0
|
|
|
|
|
0
|
last; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
} |
39
|
1
|
|
|
|
|
12
|
return $sendmail; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub send { |
43
|
0
|
|
|
0
|
0
|
|
my ($class, $message, @args) = @_; |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
my $pipe = gensym; |
46
|
|
|
|
|
|
|
|
47
|
0
|
0
|
|
|
|
|
open $pipe, "| $QMAIL @args" |
48
|
|
|
|
|
|
|
or return failure "couldn't open pipe to qmail"; |
49
|
|
|
|
|
|
|
|
50
|
0
|
0
|
|
|
|
|
print $pipe $message->as_string |
51
|
|
|
|
|
|
|
or return failure "couldn't send message to qmail"; |
52
|
|
|
|
|
|
|
|
53
|
0
|
0
|
|
|
|
|
close $pipe |
54
|
|
|
|
|
|
|
or return failure "error when closing pipe to qmail"; |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
return success; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
__END__ |