-
Notifications
You must be signed in to change notification settings - Fork 0
/
email.php
59 lines (48 loc) · 1.86 KB
/
email.php
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
<? require_once('includes/database.php'); ?>
<? require_once('includes/emails.php'); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?
extract($_REQUEST);
$result = mysql_query("SELECT * FROM emails WHERE email_id = $email_id") or die(mysql_error());
$resultRow = mysql_fetch_array($result);
extract($resultRow);
?>
<p><a href="mailbox.php?mailbox=<?=$mailbox?>">Return to <?=$mailbox?></a></p>
<table>
<tr><td><b>From:</b></td><td><?=$fromaddress?></td></tr>
<tr><td><b>To:</b></td><td><?=$toaddress?></td></tr>
<tr><td><b>CC:</b></td><td><?=$ccaddress?></td></tr>
<tr><td><b>Date:</b></td><td><?=$date?></td></tr>
<tr><td><b>Subject:</b></td><td><?=$subject?></td></tr>
<?
if (hasAttachments($email_id)) {
echo "<tr><td valign='top'><b>Attachments:</b></td><td>";
$result = mysql_query("SELECT * FROM email_bodies WHERE email_id = $email_id AND type != 'text' AND type != 'multipart' AND filename != ''") or die(mysql_error());
while($resultRow = mysql_fetch_array($result)) {
extract($resultRow);
echo "<a href='attachment.php?email_id=$email_id&part_number=$part_number'>$filename</a><br>";
}
echo "</td></tr>";
}
?>
</table>
<?
$result = mysql_query("SELECT * FROM email_bodies WHERE email_id = $email_id AND type = 'text'") or die(mysql_error());
while($resultRow = mysql_fetch_array($result)) {
extract($resultRow);
if ($encoding = "QUOTED-PRINTABLE") $body = quoted_printable_decode($body);
$body = str_replace("<hr>", "", $body);
$body = str_replace("<BODY", "<notbody>", $body);
$body = str_replace("</BODY", "</notbody>", $body);
$body = str_replace("\n", "<br>", $body);
echo "<hr><div style='width: 600px;'>$body</div><hr>";
}
?>
</body>
</html>