OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
cream
/
knoblysocial
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
06/17/2025 10:17:24 AM
rwxrwxr-x
📄
compose.php
590 bytes
05/19/2025 10:07:16 AM
rw-r--r--
📄
composer.json
126 bytes
04/09/2025 03:44:12 AM
rw-r--r--
📄
composer.lock
6.06 KB
04/09/2025 03:44:13 AM
rw-r--r--
📄
config.php
430 bytes
05/19/2025 10:07:16 AM
rw-r--r--
📄
fetch_emails.php
235 bytes
05/19/2025 10:07:16 AM
rw-r--r--
📄
himanhsu_receive_email.php
1.58 KB
05/19/2025 10:07:16 AM
rw-r--r--
📁
images
-
04/09/2025 03:44:18 AM
rwxr-xr-x
📄
inbox.js
665 bytes
04/09/2025 03:44:14 AM
rw-r--r--
📄
inbox.php
933 bytes
05/19/2025 10:07:16 AM
rw-r--r--
📄
index.html
7.62 KB
04/09/2025 03:44:14 AM
rw-r--r--
📄
index.php
6.61 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
index1.php
1.13 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
read_email.php
1.2 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
receiveEmail.php
3.46 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
send_email.php
1.29 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
sent.php
1.24 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
ses-email-receiver.php
751 bytes
05/19/2025 10:07:16 AM
rw-r--r--
📄
simple-log.txt
11.58 KB
04/09/2025 11:28:14 AM
rw-r--r--
📄
sns-log.txt
26.02 MB
06/17/2025 10:53:08 PM
rw-r--r--
📄
styles.css
1.54 KB
04/09/2025 03:44:16 AM
rw-r--r--
📄
test_parser.php
272 bytes
05/19/2025 10:07:16 AM
rw-r--r--
📁
vendor
-
05/19/2025 10:07:16 AM
rwxr-xr-x
📄
view_email.php
471 bytes
05/19/2025 10:07:16 AM
rw-r--r--
📄
working_send_email.php
1.29 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
zsns-log.txt
14.15 KB
04/09/2025 04:34:35 AM
rw-r--r--
📄
zzreceiveEmail.php
1.38 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
zzsns-log.txt
202.09 KB
04/09/2025 10:51:46 AM
rw-r--r--
Editing: receiveEmail.php
Close
<?php // Enable full error reporting ini_set('display_startup_errors', 1); require 'vendor/autoload.php'; require 'config.php'; // Your database connection file use eXorus\PhpMimeMailParser\Parser; // Logging: SNS endpoint hit file_put_contents("sns-log.txt", "DB Connected successfully\n", FILE_APPEND); file_put_contents("sns-log.txt", "SNS endpoint HIT!\n", FILE_APPEND); // Get raw POST from SNS $raw = file_get_contents('php://input'); file_put_contents("sns-log.txt", "RAW SNS PAYLOAD:\n" . $raw . "\n\n", FILE_APPEND); // Decode JSON payload $data = json_decode($raw, true); // Log the decoded data for inspection file_put_contents("sns-log.txt", "DECODED JSON DATA:\n" . print_r($data, true) . "\n\n", FILE_APPEND); // Handle Subscription Confirmation if (isset($data['Type']) && $data['Type'] === 'SubscriptionConfirmation') { $confirmation = file_get_contents($data['SubscribeURL']); file_put_contents("sns-log.txt", "Subscription Confirmed\n", FILE_APPEND); exit; } // Handle Incoming Notification (based on notificationType) if (isset($data['notificationType']) && $data['notificationType'] === 'Received') { $msg = $data['mail']; // The actual email content is within the 'mail' object echo $msg; die; if (!isset($msg['content'])) { file_put_contents("sns-log.txt", "No content field in message\n", FILE_APPEND); exit; } // Decode and parse email content $content = $msg['content']; $parser = new Parser(); $parser->setText($content); // Extract email fields $subject = $parser->getHeader('subject') ?? ''; $from = $parser->getHeader('from') ?? ''; $to = $parser->getHeader('to') ?? ''; $bodyText = $parser->getMessageBody('text') ?? ''; $bodyHtml = $parser->getMessageBody('html') ?? ''; $replyId = $parser->getHeader('in-reply-to') ?? ''; // Choose which body to store (prioritize text if available) $body = !empty($bodyText) ? $bodyText : $bodyHtml; // Log the parsed values file_put_contents("sns-log.txt", "Parsed Email:\nFrom: $from\nTo: $to\nSubject: $subject\nReply ID: $replyId\nBody (text): " . substr($bodyText, 0, 200) . "...\nBody (html): " . substr($bodyHtml, 0, 200) . "...\nFinal Body to Store: " . substr($body, 0, 200) . "...\n\n", FILE_APPEND); // Log variables before database insertion file_put_contents("sns-log.txt", "Preparing to insert:\nSender Email: $from\nRecipient Email: $to\nSubject: $subject\nBody: " . substr($body, 0, 100) . "...\nReply ID: $replyId\n\n", FILE_APPEND); // Prepare SQL insert $stmt = $conn->prepare("INSERT INTO email (sender_email, recipient_email, subject, body, reply_body, received_at) VALUES (?, ?, ?, ?, ?, NOW())"); if (!$stmt) { file_put_contents("sns-log.txt", "Prepare failed: " . $conn->error . "\n", FILE_APPEND); exit; } $stmt->bind_param("sssss", $from, $to, $subject, $body, $replyId); if (!$stmt->execute()) { file_put_contents("sns-log.txt", "Execute failed: " . $stmt->error . "\n", FILE_APPEND); } else { file_put_contents("sns-log.txt", "Insert successful for email from $from to $to with subject '$subject'\n", FILE_APPEND); } $stmt->close(); } else { file_put_contents("sns-log.txt", "Unknown SNS message type or missing 'notificationType' field for regular email.\n", FILE_APPEND); } // Close the database connection if (isset($conn)) { $conn->close(); } ?>