/usr/share/perl5/Email/Send/Qmail.pm is in libemail-send-perl 2.198-4.
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 | package Email::Send::Qmail;
use strict;
use File::Spec ();
use Return::Value;
use Symbol qw(gensym);
use vars qw[$QMAIL $VERSION];
$QMAIL ||= q[qmail-inject];
$VERSION = '2.198';
sub is_available {
my $class = shift;
return failure "No qmail found" unless $class->_find_qmail;
return success;
}
sub _find_qmail {
my $class = shift;
my $sendmail;
if (-x $QMAIL) {
return $QMAIL;
}
my @path = File::Spec->path;
push @path, '/usr/sbin' unless grep m!^/usr/sbin/?$!, @path;
for my $dir (@path) {
if ( -x "$dir/$QMAIL" ) {
$sendmail = "$dir/$QMAIL";
last;
}
}
return $sendmail;
}
sub send {
my ($class, $message, @args) = @_;
my $pipe = gensym;
open $pipe, "| $QMAIL @args"
or return failure "couldn't open pipe to qmail";
print $pipe $message->as_string
or return failure "couldn't send message to qmail";
close $pipe
or return failure "error when closing pipe to qmail";
return success;
}
1;
__END__
=head1 NAME
Email::Send::Qmail - Send Messages using qmail-inject
=head1 SYNOPSIS
use Email::Send;
Email::Send->new({mailer => 'Qmail'})->send($message);
=head1 DESCRIPTION
This mailer for C<Email::Send> uses C<qmail-inject> to put a message in
the Qmail spool. It I<does not> try hard to find the executable. It just
calls C<qmail-inject> and expects it to be in your path. If that's not
the case, or you want to explicitly define the location of your
executable, alter the C<$Email::Send::Qmail::QMAIL> package variable.
$Email::Send::Qmail::QMAIL = '/usr/sbin/qmail-inject';
=head1 SEE ALSO
L<Email::Send>,
L<perl>.
=head1 AUTHOR
Current maintainer: Ricardo SIGNES, <F<rjbs@cpan.org>>.
Original author: Casey West, <F<casey@geeknest.com>>.
=head1 COPYRIGHT
Copyright (c) 2004 Casey West. All rights reserved.
This module is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
=cut
|