-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathview_full_mail.php
71 lines (64 loc) · 2.26 KB
/
view_full_mail.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
60
61
62
63
64
65
66
67
68
69
70
71
<?php
// view_full_mail.php
require 'vendor/autoload.php';
require 'config.php';
require 'mail_reader.php';
use O365Integration\O365MailReader;
session_start();
if (!isset($_GET['id'])) {
die('Mail ID gerekli');
}
try {
$reader = new O365MailReader($_SESSION['access_token']);
$message = $reader->readMessage($_GET['id']);
?>
<!DOCTYPE html>
<html>
<head>
<title>Mail Detayı</title>
<style>
.mail-container { margin: 20px; padding: 20px; border: 1px solid #ddd; }
.mail-header { margin-bottom: 20px; padding-bottom: 10px; border-bottom: 1px solid #eee; }
.mail-body { padding: 10px; }
.attachment { margin: 5px; padding: 5px; background: #f5f5f5; }
</style>
</head>
<body>
<div class="mail-container">
<div class="mail-header">
<h2><?= htmlspecialchars($message['subject']) ?></h2>
<p><strong>Kimden:</strong> <?= htmlspecialchars($message['from']['emailAddress']['address']) ?></p>
<p><strong>Tarih:</strong> <?= date('d.m.Y H:i', strtotime($message['receivedDateTime'])) ?></p>
<?php if (!empty($message['attachments'])): ?>
<div class="attachments">
<h3>Ekler:</h3>
<?php foreach ($message['attachments'] as $attachment): ?>
<div class="attachment">
<?= htmlspecialchars($attachment['name']) ?>
(<?= number_format($attachment['size'] / 1024, 2) ?> KB)
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
<div class="mail-body">
<?php
// HTML içerik varsa
if ($message['body']['contentType'] === 'html') {
// Güvenli HTML içeriği göster
echo strip_tags($message['body']['content'], '<p><br><b><i><u><strong><em>');
} else {
// Düz metin içeriği
echo nl2br(htmlspecialchars($message['body']['content']));
}
?>
</div>
</div>
<p><a href="read_mails.php">← Listeye Geri Dön</a></p>
</body>
</html>
<?php
} catch (Exception $e) {
echo "Hata: " . $e->getMessage();
}
?>