Files
webmin/postfix/detach_queue.cgi
2026-05-23 17:15:31 -05:00

32 lines
758 B
Perl
Executable File

#!/usr/local/bin/perl
# detach_queue.cgi
# View one attachment from a queued message
require './postfix-lib.pl'; ## no critic
use strict;
use warnings;
our ($attach, $mail, %access, %in, %text);
require './boxes-lib.pl'; ## no critic
&ReadParse();
$access{'mailq'} || &error($text{'mailq_ecannot'});
$mail = &parse_queue_file($in{'id'});
$mail || &error($text{'mailq_egone'});
&parse_mail($mail);
$attach = $mail->{'attach'}->[$in{'attach'}];
print "X-no-links: 1\n";
if ($attach->{'type'} eq 'message/delivery-status') {
print "Content-type: text/plain\n\n";
}
else {
print "Content-type: $attach->{'type'}\n\n";
}
if ($attach->{'type'} =~ /^text\/html/i) {
print &filter_javascript($attach->{'data'});
}
else {
print $attach->{'data'};
}