This file is indexed.

/usr/share/doc/libmime-tools-perl/examples/mimesend is in libmime-tools-perl 5.509-1.

This file is owned by root:root, with mode 0o755.

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
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#!/usr/bin/perl -w

=head1 NAME

mimesend - send files via MIME mail, from the command line

=head1 USAGE

Pretty basic:

    mimesend [-n] [-t to] [-s subj] (-f file [-m type])+
        -n        Don't actually send it; just print it to stdout.
        -t to     The "to" address.
        -s subj   The subject of the message.
        -f file   Path to attached file, or - for STDIN.
        -m type   MIME type of previous -f; therefore -m must follow -f.

For example:

    mimesend -t you@yourhost.com -s "Hello, nurse!" 
          -f greetings.htm -f foo.gif 

=head1 AUTHOR

Eryq, eryq@zeegee.com

8 Jan 1997

=cut

use lib "./lib";
use MIME::Entity;

# Lookup table:
my %TypeFor = qw(
    txt   text/plain
    sh    text/x-sh
    csh   text/x-csh
    pm    text/x-perl
    pl    text/x-perl
    jpg   image/jpeg
    jpeg  image/jpeg
    gif   image/gif
    tif   image/tiff
    tiff  image/tiff
    xbm   image/xbm
    pdf   application/pdf
    );

# Usage:
@ARGV or die <<EOF;
Usage:
    mimesend [-t to] [-s subj] (-f file [-m type])+
        -n        Don't actually send it; just print it to stdout.
        -t to     The "to" address.
        -s subj   The subject of the message.
        -f file   Path to attached file.
        -m type   MIME type of most recent attached file.

EOF

# Type:
sub type_for {
    my $path = shift;

    my ($ext) = ($path =~ /\.([a-z0-9]+)\Z/i);
    ($ext and $TypeFor{lc($ext)}) or
	(-T $path ? 'text/plain' : 'application/octet-stream');
}

# Get args:
my $nosend;
my @files;
ARG: while (@ARGV) {
    $_ = shift @ARGV;
    /^-n/ and do {
	$nosend = 1;
        next ARG;
    };
    /^-t(.*)/ and do {
	$to = $1 || shift @ARGV;
        next ARG;
    };
    /^-s(.*)/ and do {
	$subj = $1 || shift @ARGV;
        next ARG;
    };
    /^-f(.*)/ and do {
        push @files, [$1||shift @ARGV];
        next ARG;
    };
    /^-m(.*)/ and do {
        $files[-1][1] = $1 || shift @ARGV;
        next ARG;
    };
    die "$0: bad usage: <$_>.\n";
}

# Verify destination:
$to or die "$0: missing [-t to]\n";

# Verify subject:
$subj or die "$0: missing [-s subject]\n";

# Start with top-level entity:
my $top;
if (!@files) {
    die "$0: no files specified!\n";
}
elsif (@files == 1) {
   my ($path, $type) = @{$files[0]};

   # Build:
   $top =  build MIME::Entity 
       Type     => ($type || type_for($path)),
       $path eq '-' ? (Data => [<>]) : (Path => $path),
       Encoding => '-SUGGEST';
   $top->head->add('To', $to);
   $top->head->add('Subject', $subj);
}
else {

    # Start with top:
    $top =  build MIME::Entity Type=>"multipart/mixed";
    $top->head->add('To', $to);
    $top->head->add('Subject', $subj);

    # Attach files:
    foreach (@files) {
	my ($path, $type) = @{$_};
	$top->attach(Type     => ($type || type_for($path)),
		     Path     => $path,
		     Encoding => '-SUGGEST');
    }
}

# Launch mailer and send message?
if (!$nosend) {
   open SENDMAIL, "|/usr/lib/sendmail -t -oi -oem" 
       or die "$0: open sendmail: $!\n";
   $top->print(\*SENDMAIL);
   close SENDMAIL;
   die "sendmail failed" if ($? >> 255);
}
else {
   $top->print(\*STDOUT);
}
1;