User tests: Successful: Unsuccessful:
Pull Request for Issue #34287
Allows the use of place holders in the custom file name of an attachment for mail templates.
Install a fresh Joomla 4 - set up your mail settings correctly and test them.
(Tip: Learn what MailHog is if you dont already use it!)
joomla_blank.png
{METHOD}_test.png
as the name of the file{METHOD}_test.png
would be the name of the file attached to your email
{METHOD}
will get replaced with your mail method (Mine is SMTP)
Mine therefore is SMTP_test.png
when attached.
None - its a secret.
Thinking how this feature might be used, the 3pd might want to add dynamic detail to the file name. E.g Joe Blogs buys an ebook, and so the filename becomes Order123_Bloggs_book.pdf dynamically using the placeholders.
### Security
I cannot see a way that this can be used to spoof anything, happy to be proved wrong. The same checks on file extensions will still apply, and phpMailer restrictions on the files name will also apply still as they did before this PR.
Status | New | ⇒ | Pending |
Category | ⇒ | Libraries |
Title |
|
Labels |
Added:
?
|
then you obviously did not read what I wrote when I gave you one
Thinking how this feature might be used, the 3pd might want to add dynamic detail to the file name. E.g Joe Blogs buys an ebook, and so the filename becomes Order123_Bloggs_book.pdf dynamically using the placeholders.
Also can be used for translating filenames...
then you obviously did not read what I wrote when I gave you one
I read it. But I still don't see a real use case for this. It's my personal option. You can wait for feedback from others.
In Joomla CMS, no there is not currently a use case.
But Joomla is more than just its CMS. Its a framework for developers and 3pd also. There is no reason NOT to add this, especially when placeholders can be added to the rest of the mail (subject, body).
3pd are always pushing the boundaries of what Joomla does.
I'm a third party developer and I can tell you that I would not use tags in filename of attachment. Anyway, that's just my personal opinion (and I'm happy to not have to make decision :) ).
@joomdonation until yesterday I would have agreed with you but last night I came across a situation using an event registration system where it would have been really great
@brianteeman Thanks for the info.
@PhilETaylor I tried to add a file but in the nightly build clicking the "Plus" doesn't add a field or add an image selector. Is this a problem in the nightly build?
No idea - it certainly used to work, Check your Console tab for any errors.
That error is unrelated.
I have tested this item
I have tested this issue with the two allowed placeholders (sitename & method), using Mailhog and it works successfully.
Joomla Version: 4.0.0-rc4
PHP Version: 7.4.13
One question, why is it not possible to use the lowercase placeholders?
I have tested this item
Tested with Devilbox. PHP 7.4.
After applying the path and follow testing instructions the file attached name is Mail_test.png
Status | Pending | ⇒ | Ready to Commit |
RTC
Labels |
Added:
?
|
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2021-07-21 21:47:46 |
Closed_By | ⇒ | wilsonge |
Thanks!
This works, but honestly, I could not see a real use-case for this option.