User tests: Successful: Unsuccessful:
Pull Request for Issue # .
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:
addAttachment
method includes the $disposition
parameter in all cases.$name
is an array before comparing its count with $path
.Set the option Mail Format
-> HTML in Global Configuration -> Mail Templates
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;">';
Send a test mail under Global Configuration
-> Server tab
at the bottom of the page using the Send Test Mail
button
Attachment is inserted but not as an inline attachment and thus the assignment to the image fails.
Attachment is inserted as an inline attachment and thus the assignment to the image works.
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
Status | New | ⇒ | Pending |
Category | ⇒ | Libraries |
I have tested this item ✅ successfully on 574d39d
Status | Pending | ⇒ | Ready to Commit |
Labels |
Added:
bug
PR-5.1-dev
|
RTC
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
|
Thx
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.