Skip to content

Commit 2d7667e

Browse files
authored
[4.4] Escape unsafe tags in mail copy to sender and notification to admin and don't escape custom email fields (joomla#43981)
* Escape also copy to sender in contact form email * Escape also new user notification email to admins * Remove customfields from unsafe tags
1 parent ddf3f3b commit 2d7667e

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

components/com_contact/src/Controller/ContactController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ private function _sendEmail($data, $contact, $emailCopyToSender)
271271
$mailer->addRecipient($contact->email_to);
272272
$mailer->setReplyTo($templateData['email'], $templateData['name']);
273273
$mailer->addTemplateData($templateData);
274-
$mailer->addUnsafeTags(['name', 'email', 'body', 'customfields']);
274+
$mailer->addUnsafeTags(['name', 'email', 'body']);
275275
$sent = $mailer->send();
276276

277277
// If we are supposed to copy the sender, do so.
@@ -280,6 +280,7 @@ private function _sendEmail($data, $contact, $emailCopyToSender)
280280
$mailer->addRecipient($templateData['email']);
281281
$mailer->setReplyTo($templateData['email'], $templateData['name']);
282282
$mailer->addTemplateData($templateData);
283+
$mailer->addUnsafeTags(['name', 'email', 'body']);
283284
$sent = $mailer->send();
284285
}
285286
} catch (MailDisabledException | phpMailerException $exception) {

components/com_users/src/Model/RegistrationModel.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,7 @@ public function register($temp)
555555
$mailer = new MailTemplate('com_users.registration.admin.new_notification', $app->getLanguage()->getTag());
556556
$mailer->addTemplateData($data);
557557
$mailer->addRecipient($row->email);
558+
$mailer->addUnsafeTags(['username', 'name']);
558559
$return = $mailer->send();
559560
} catch (\Exception $exception) {
560561
try {

0 commit comments

Comments
 (0)