From ec1c1d9dd8e544a1a01504d6c386794737dc1c94 Mon Sep 17 00:00:00 2001 From: Oana Ursuleasa Date: Thu, 13 Feb 2025 16:59:06 +0200 Subject: [PATCH] add a header "Reply-To" with the email address --- lib/CreateCardClass.php | 4 ++-- lib/MailClass.php | 22 ++++++++++++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/lib/CreateCardClass.php b/lib/CreateCardClass.php index 3bb3d2c..ec0530d 100644 --- a/lib/CreateCardClass.php +++ b/lib/CreateCardClass.php @@ -67,9 +67,9 @@ class CreateCardClass{ if (MAIL_NOTIFICATION) { if (!$response) { - $inbox->reply($mailSender->origin); + $inbox->reply($mailSender->origin,$mailSender->userId); } - $inbox->reply($mailSender->origin, $response); + $inbox->reply($mailSender->origin,$mailSender->userId, $response); } }else{ $cleanedDescription = $newcard->extractForwardedContent($data->description); diff --git a/lib/MailClass.php b/lib/MailClass.php index ec15158..d5e08c3 100644 --- a/lib/MailClass.php +++ b/lib/MailClass.php @@ -54,7 +54,7 @@ class MailClass { return $headerInfo; } - public function reply($sender, $response = null) { + public function reply($sender, $sendername, $response = null) { $server = NC_SERVER; if(strstr($server, "https://")) { @@ -99,8 +99,25 @@ class MailClass { $subject = "A new card could not be created!"; } + //Inline image + $description = $response->description; + $pattern = '/\[(.*?)\]\((https?:\/\/.*\.(?:jpg|jpeg|png|gif))\)/i'; + if (preg_match($pattern, $description)) { + $descriptionFormatted = preg_replace('/\[(.*?)\]\((.*?)\)/', '$1', $description); + }else{ + $descriptionFormatted = $description; + + //Attachements + $attachments = $response->attachments; + if (!empty($attachments)) { + foreach ($attachments as $attachment) { + $descriptionFormatted .= "
$attachment
"; + } + } + } + $bodySupport="

board}/card/{$response->id}" . "\">{$response->title}

" - ."

{$response->description}

" + ."

{$descriptionFormatted}

" ."

Sent by: {$sender}

"; @@ -126,6 +143,7 @@ class MailClass { * EMAIL 2: email to support team */ $mail->addAddress(MAIL_SUPPORT); + $mail->addReplyTo($sender, $sendername); $mail->Subject = "New Card Issue Notification"; $mail->Body = "" ."mail2deck response"