Skip to content

Commit

Permalink
Merge pull request #1070 from itflow-org/email-parse-eml
Browse files Browse the repository at this point in the history
Email parser - bugfix saving the original message
  • Loading branch information
johnnyq committed Sep 22, 2024
2 parents 3c6b9ea + eb831b5 commit 8e96549
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cron_ticket_email_parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -410,9 +410,12 @@ function getInboxFolder($client, $inboxNames) {
foreach ($messages as $message) {
$email_processed = false;

// Save original message
mkdirMissing('uploads/tmp/');
$original_message_file = "processed-eml-" . randomString(200) . ".eml";
file_put_contents("uploads/tmp/{$original_message_file}", $message->getRawMessage());
$eml_content = json_decode(json_encode($message->getHeader()), true)['raw'];
$eml_content .= $message->getRawBody();
file_put_contents("uploads/tmp/{$original_message_file}", $eml_content);

$from_address = $message->getFrom();
$from_name = sanitizeInput($from_address[0]->personal ?? 'Unknown');
Expand Down

0 comments on commit 8e96549

Please sign in to comment.