1 |
#!/usr/local/bin/perl |
#!/usr/local/bin/perl |
2 |
|
|
3 |
BEGIN { $APP_PATH="foo/bar"; } |
BEGIN { $APP_PATH="/home/httpd/html/webmail/cgi-bin/"; } |
4 |
|
|
5 |
# @ ---------------------------------------------------------------------------------------------------------- |
# @ ---------------------------------------------------------------------------------------------------------- |
6 |
# @ This code is (c) 1999 Alexandre Aufrere and NikoSoft. |
# @ This code is (c) 1999 Alexandre Aufrere and NikoSoft. |
89 |
#How many messages are there in the inbox provided by the $pop object? |
#How many messages are there in the inbox provided by the $pop object? |
90 |
$MessageCount = $pop->Count; |
$MessageCount = $pop->Count; |
91 |
|
|
92 |
|
#gather additional size info |
93 |
|
@MessageSize = $pop->ListArray; |
94 |
|
|
95 |
print "<table><tr><td>"; |
print "<table><tr><td>"; |
96 |
#if $pop->count is -1, then the POP connection failed. |
#if $pop->count is -1, then the POP connection failed. |
106 |
#if $pop->count is >0, then that is the number of messages in the |
#if $pop->count is >0, then that is the number of messages in the |
107 |
#POP account inbox. |
#POP account inbox. |
108 |
else { print "<img src=$MAIL_IMG valign=middle> "; |
else { print "<img src=$MAIL_IMG valign=middle> "; |
109 |
print "<b>$MessageCount $messagesininbox.</b>\n"; |
print "<b>$MessageCount $messagesininbox (",$pop->Size," $bytestotaltext).</b>\n"; |
110 |
} |
} |
111 |
|
|
112 |
#print "</td><td width=300 align=center>\n"; |
#print "</td><td width=300 align=center>\n"; |
140 |
|
|
141 |
if ($MessageCount > 0) { |
if ($MessageCount > 0) { |
142 |
print "<table border=0 cellpadding=2 cellspacing=0 width=90% align=center>"; |
print "<table border=0 cellpadding=2 cellspacing=0 width=90% align=center>"; |
143 |
print "<tr bgcolor=darkblue><td><b><font color=white>$fromtext</b></td><td><b><font color=white>$subjecttext</b></td><td><b><font color=white>$datetext</b></td><td> </td>"; |
print "<tr bgcolor=darkblue><td><b><font color=white>$fromtext</b></td><td><b><font color=white>$subjecttext</b></td><td><b><font color=white>$datetext</b></td><td colspan=2><font color=white><b>$sizetext </b></td>"; |
144 |
&ParseHeaders(); |
&ParseHeaders(); |
145 |
print "</table>"; |
print "</table>"; |
146 |
} |
} |
147 |
|
|
180 |
|
|
181 |
#----------------------------------SUBROUTINES------------------------- |
#----------------------------------SUBROUTINES------------------------- |
182 |
|
|
183 |
|
# Decode quoted strings (in From: and Subject) |
184 |
|
|
185 |
|
sub DecodeQuoted { |
186 |
|
my $tmp = $_[0]; |
187 |
|
if ($tmp =~ /=?ISO-8859-[1-2]?(.)?/i) { |
188 |
|
$tmp =~ s/=([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; |
189 |
|
$tmp =~ s/=\?ISO-8859-[1-2]\?.\?(.*)\?=/$1/i; |
190 |
|
} |
191 |
|
return $tmp; |
192 |
|
} |
193 |
|
|
194 |
#-----------------------------Sub ParseHeaders----------------------------- |
#-----------------------------Sub ParseHeaders----------------------------- |
195 |
#Subroutine to parse the headers on each message to exctract the TO:, FROM:, |
#Subroutine to parse the headers on each message to exctract the TO:, FROM:, |
240 |
#of each line |
#of each line |
241 |
if (/^From:/ ){ |
if (/^From:/ ){ |
242 |
$from = $'; #Get string following the succesful match. |
$from = $'; #Get string following the succesful match. |
243 |
|
$from = DecodeQuoted($from); |
244 |
$from =~ s/</<\;/; #Strip out angled brackets to prevent browsers |
$from =~ s/</<\;/; #Strip out angled brackets to prevent browsers |
245 |
$from =~ s/>/>\;/; #from interpreting them as unknown HTML codes. |
$from =~ s/>/>\;/; #from interpreting them as unknown HTML codes. |
246 |
} |
} |
249 |
} |
} |
250 |
elsif (/^Subject:/) { |
elsif (/^Subject:/) { |
251 |
$sub = $'; |
$sub = $'; |
252 |
|
$sub = DecodeQuoted($sub); |
253 |
} |
} |
254 |
elsif (/^Date:/) { |
elsif (/^Date:/) { |
255 |
$date = $'; |
$date = $'; |
256 |
} |
} |
257 |
} |
} |
258 |
$date=~ s/.*\,(.*)\+.*/$1/; |
$date=~ s/.*\,(.*)\+.*/$1/; |
259 |
print "<td><a href='.' OnClick='document.lire$i.submit();return false;'>$from </a></td><td><b>$sub </b></td><td>$date </td>"; |
$date="<small>$date</small>"; |
260 |
|
|
261 |
|
$size=$MessageSize[$i]; |
262 |
|
$size="<small>".int(($size+512)/1024)."k</small>"; |
263 |
|
|
264 |
|
print "<td><a href='.' OnClick='document.lire$i.submit();return false;'>$from </a></td><td><b>$sub </b></td><td>$date </td><td align=right>$size</td>"; |
265 |
|
|
266 |
#for each message header, also provide a FORM button to |
#for each message header, also provide a FORM button to |
267 |
#delete using inbox.pl As above, pass in the needed vars |
#delete using inbox.pl As above, pass in the needed vars |