Handle hostnames with upper-case letters
[webmin.git] / qmailadmin / view_queue.cgi
1 #!/usr/local/bin/perl
2 # view_queue.cgi
3 # Display some message from the mail queue
4
5 require './qmail-lib.pl';
6 &ReadParse();
7
8 $mail = &read_mail_file($in{'file'});
9 &parse_mail($mail);
10
11 $desc = &text('qview_desc', "<tt>$in{'file'}</tt>");
12 &ui_print_header($desc, $text{'qview_title'}, "");
13
14 print "<form action=delete_queue.cgi method=post>\n";
15 print "<input type=hidden name=file value='$in{'file'}'>\n";
16 print "<table width=100% border=1>\n";
17 print "<tr> <td $tb><b>$text{'qview_headers'}</b></td> </tr>\n";
18 print "<tr> <td $cb><table width=100%>\n";
19 print "<tr> <td><b>$text{'queue_from'}</b></td> ",
20       "<td>",&html_escape($mail->{'header'}->{'from'}),"</td> </tr>\n";
21 print "<tr> <td><b>$text{'queue_to'}</b></td> ",
22       "<td>",&html_escape($mail->{'header'}->{'to'}),"</td> </tr>\n";
23 print "<tr> <td><b>$text{'queue_cc'}</b></td> ",
24       "<td>",&html_escape($mail->{'header'}->{'cc'}),"</td> </tr>\n"
25         if ($mail->{'header'}->{'cc'});
26 print "<tr> <td><b>$text{'queue_date'}</b></td> ",
27       "<td>",&html_escape($mail->{'header'}->{'date'}),"</td> </tr>\n";
28 print "<tr> <td><b>$text{'queue_subject'}</b></td> ",
29       "<td>",&html_escape($mail->{'header'}->{'subject'}),"</td> </tr>\n";
30 print "</table></td></tr></table><p>\n";
31
32 # Find body attachment
33 @attach = @{$mail->{'attach'}};
34 foreach $a (@attach) {
35         if ($a->{'type'} eq 'text/plain') {
36                 $body = $a;
37                 last;
38                 }
39         }
40 if ($body) {
41         print "<table width=100% border=1><tr><td $cb><pre>\n";
42         foreach $l (&wrap_lines($body->{'data'}, $config{'wrap_width'})) {
43                 print &link_urls_and_escape($l),"\n";
44                 }
45         print "</pre></td></tr></table><p>\n";
46         }
47
48 # Display other attachments
49 @attach = grep { $_ ne $body } @attach;
50 @attach = grep { !$_->{'attach'} } @attach;
51 if (@attach) {
52         print "<table width=100% border=1>\n";
53         print "<tr> <td $tb><b>$text{'qview_attach'}</b></td> </tr>\n";
54         print "<tr> <td $cb>\n";
55         foreach $a (@attach) {
56                 push(@titles, $a->{'filename'} ? $a->{'filename'}
57                                                : $a->{'type'});
58                 push(@links, "detach_queue.cgi?file=$in{'file'}&attach=$a->{'idx'}");
59                 push(@icons, "images/boxes.gif");
60                 }
61         &icons_table(\@links, \@titles, \@icons, 8);
62         print "</td></tr></table><p>\n";
63         }
64
65 print "<input type=submit value='$text{'delete'}'></form>\n";
66
67 &ui_print_footer("list_queue.cgi", $text{'queue_return'});
68