RTC bug PR-5.1-dev Pending

User tests: Successful: Unsuccessful:

avatar LadySolveig
LadySolveig
23 Jul 2024

Pull Request for Issue # .

Summary of Changes

It is currently not possible to attach a single attachment with the disposition 'inline' to a mail via the Mail library class.

Above all, this means that it is also not possible to send an image as an inline attachment via the Mail class and then simply refer to it via cid.

This means that in the e-mails that are sent when they are received on different clients, the download of the images must first be approved by the user before they are visible.

The changes in the Mail class address issues with attachment handling. Specifically:

  • Ensured the addAttachment method includes the $disposition parameter in all cases.
  • Simplified the logic for adding attachments by removing redundant checks.
  • Added a check to ensure $name is an array before comparing its count with $path.

Testing Instructions

Set the option Mail Format -> HTML in Global Configuration -> Mail Templates

grafik

Add the following lines of code (only!) for testing into the file 'libraries/src/Mail/MailTemplate.php' line 277

$logo = Path::clean(JPATH_ROOT . '/images/banners/white.png');
# Attach the logo as inline attachement
$this->mailer->addAttachment($logo, basename($logo), 'base64', mime_content_type($logo), 'inline');
// We need only the cid for attached logo file inline
$htmlBody .= '<img src="cid:' . htmlspecialchars(basename($logo), ENT_QUOTES) . '" alt="Test inline attachment" style="max-width:80%;height:auto;border:none;text-decoration:none;color:#ffffff;">';

grafik

Send a test mail under Global Configuration -> Server tab at the bottom of the page using the Send Test Mail button

grafik

Actual result BEFORE applying this Pull Request

Attachment is inserted but not as an inline attachment and thus the assignment to the image fails.

grafik

grafik

Expected result AFTER applying this Pull Request

Attachment is inserted as an inline attachment and thus the assignment to the image works.
grafik
grafik

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

avatar LadySolveig LadySolveig - open - 23 Jul 2024
avatar LadySolveig LadySolveig - change - 23 Jul 2024
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 23 Jul 2024
Category Libraries
avatar brianteeman brianteeman - test_item - 23 Jul 2024 - Tested successfully
avatar brianteeman
brianteeman - comment - 23 Jul 2024

I have tested this item ✅ successfully on 574d39d


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43828.

avatar bembelimen bembelimen - test_item - 23 Jul 2024 - Tested successfully
avatar bembelimen
bembelimen - comment - 23 Jul 2024

I have tested this item ✅ successfully on 574d39d


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43828.

avatar Quy Quy - change - 23 Jul 2024
Status Pending Ready to Commit
Labels Added: bug PR-5.1-dev
avatar Quy
Quy - comment - 23 Jul 2024

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43828.

avatar bembelimen bembelimen - close - 23 Jul 2024
avatar bembelimen bembelimen - merge - 23 Jul 2024
avatar bembelimen bembelimen - change - 23 Jul 2024
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2024-07-23 17:10:58
Closed_By bembelimen
Labels Added: RTC
avatar bembelimen
bembelimen - comment - 23 Jul 2024

Thx

Add a Comment

Login with GitHub to post a comment