Skip to content

[Bugfix] Mail 047999: Fix CC/BCC Mails Generic Placeholder not replaced with corresponding value#11713

Open
fhelfer wants to merge 2 commits into
ILIAS-eLearning:release_10from
fhelfer:mail/mantis/47999
Open

[Bugfix] Mail 047999: Fix CC/BCC Mails Generic Placeholder not replaced with corresponding value#11713
fhelfer wants to merge 2 commits into
ILIAS-eLearning:release_10from
fhelfer:mail/mantis/47999

Conversation

@fhelfer

@fhelfer fhelfer commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

@fhelfer fhelfer added bugfix php Pull requests that update Php code labels Jun 30, 2026
'mail_salutation' => [
'placeholder' => 'MAIL_SALUTATION',
'label' => $this->getLanguage()->txt('mail_nacc_salutation'),
'requiresRecipient' => true,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • requiresRecipient should be part of the array shape definition (PHPDocs)
  • Maybe there are other placeholders in specific mail template contexts which are also generic (like a course title). Therefore, I carefully ask: Do you see any other approach to achieve the desired behaviour?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the interim fix, we also need to add requiresRecipient to all mail contexts. Right now there’s no reliable way to tell which specific placeholders are user-specific vs. context-specific. Generic ones already have it; specific ones don’t — and some contexts still short-circuit everything when there’s no recipient. Study Programme is the worst offender: if (is_null($recipient)) { return ''; } wipes all placeholders, even ones that only need the object/context (title, link, etc.).

Long-term (planned for ILIAS 12): a proper refactor. Placeholders become small classes implementing interfaces, collected the same way mail signatures already work — placeholder classes + a supports() check on the consumer side. Contexts would declare what they support (installation, user, object/course/study programme, …), and only matching placeholders get resolved. That way we reuse placeholders across contexts instead of reimplementing them in every il*MailTemplateContext.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix php Pull requests that update Php code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants