Skip to content

Commit

Permalink
Improve @fwd detection when forwarding emails - closes #2940
Browse files Browse the repository at this point in the history
  • Loading branch information
freescout-help-desk committed Sep 11, 2024
1 parent b90f3d7 commit 5a989ec
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/Console/Commands/FetchEmails.php
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ public function processMessage($message, $message_id, $mailbox, $mailboxes, $ext
&& !$user_id && !$is_reply && !$prev_thread
// Only if the email has been sent to one mailbox.
&& count($to) == 1 && count($cc) == 0
&& preg_match("/^[\s]*".self::FWD_AS_CUSTOMER_COMMAND."/su", trim(strip_tags($body)))
&& preg_match("/^[\s]*".self::FWD_AS_CUSTOMER_COMMAND."/su", strtolower(trim(strip_tags($body))))
) {
// Try to get "From:" from body.
$original_sender = $this->getOriginalSenderFromFwd($body);
Expand Down Expand Up @@ -871,7 +871,7 @@ public function getOriginalSenderFromFwd($body)
// https://github.com/freescout-helpdesk/freescout/issues/2672
$body = preg_replace("/[\"']cid:/", '!', $body);
// Cut out the command, otherwise it will be recognized as an email.
$body = preg_replace("/".self::FWD_AS_CUSTOMER_COMMAND."([\s<]+)/su", '$1', $body);
$body = preg_replace("/".self::FWD_AS_CUSTOMER_COMMAND."([\s<]+)/isu", '$1', $body);

// Looks like email texts may appear in attributes:
// https://github.com/freescout-helpdesk/freescout/issues/276
Expand Down

0 comments on commit 5a989ec

Please sign in to comment.