Skip to content

Conversation

@kjansen2608
Copy link

@kjansen2608 kjansen2608 commented May 13, 2025

This PR proposes using the "Layout > Page > Mail" UI component (see #9564) for sending external emails in ILIAS.
The rendered HTML is enhanced with specific styles from the dedicated "mail.css" (see #9565).

Depends on:

Copy link
Contributor

@mjansenDatabay mjansenDatabay left a comment

Choose a reason for hiding this comment

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

Thanks @kjansen2608,

I am mostly fine with these changes (which is not surprising, since I already had the opportunity to read this code internally) before this pull request.
I just left a few remarks on some minor points that I would kindly ask you (or your colleagues) to adjust.

Best regards,
Michael

)->withLogoSrc(
'cid:' . $this->getLogoCid($skin, $style)
)->withFooterURL(
$factory->link()->standard(ILIAS_HTTP_PATH, ILIAS_HTTP_PATH)
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use ilUtil::_getHttpPath() here, since mails are also sent during cron jobs with PHP CLI, where ILIAS_HTTP_PATH cannot be determined and must be read from the "ilias.ini.php".

foreach ($locations as $location) {
$custom_directory = $this->getPathToRootDirectory(
) . '/public/Customizing/skin/' . $location . '/components/ILIAS/Mail/img';
$custom_directory = $this->getPathToRootDirectory() . "/public/Customizing/skin/$location/images/logo";
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we move this sub-path to a private PHP string constant (containing a placeholder for $location) to the top of the class and just replace the placeholder here?

}

return file_get_contents($bracket_path);
return 'assets/css/mail.css';
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we move this path to a private PHP constant to the top of the class?

}
}
} else {
$path = $this->getPathToRootDirectory() . '/components/ILIAS/Mail/templates/default/img/ilias_logo.jpg';
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we move this sub-path to a private PHP constant to the top of the class?

foreach ($locations as $location) {
$custom_path = $this->getPathToRootDirectory(
) . '/public/Customizing/skin/' . $location . '/components/ILIAS/Mail/tpl.html_mail_template.html';
$custom_path = $this->getPathToRootDirectory() . "/public/Customizing/skin/$location/mail.css";
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we move this sub-path to a private PHP string constant (containing a placeholder for $location) to the top of the class and just replace the placeholder here?

protected function buildBodyMultiParts(string $skin, string $style): void
private function getPathToRootDirectory(): string
{
return realpath(dirname(__DIR__, 4) . '/');
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest making this more dynamic. We could traverse up the directory tree until we find the ilias_version.php. I agree, even this is a bit fragile, but as long as the ILIAS core does not provide a central helper function for this, this is IMO the best approach.

@mjansenDatabay mjansenDatabay added the php Pull requests that update Php code label Aug 22, 2025
adds mail component

adjust docu and move css

adds delos.css to mail template

display logo inline

changes html line-breaks

adds Test for MailPage

uses default header-icon instead of new .jpg

fix test

removes URL from template

updates mail-docu and renames tpl-var

fix header css

design fixes

Fix CS for Mail-Interface

Fix CS for Mail Implementation

remove unrelated fixes

Fix CS for Mail test

Fix CS for Renderer

Fix CS

change ui-mail content type from string to Content

use mail.css instead off delos.css

build delos.css

fix tests

fix docu

use Dataprovider

remove testGetContent

removes usage of call_user_func and add commas

adjust docu

improve mail renderer

apply all suggestions

fix tests

apply all suggestions

use ui-mail-component for mail

fix line breaks

refactor mail-build

adds compatibility for skins

adds skin support

fix method visibility

Fix CS

fix use of ui-mail-component

use mail.css instead off delos.css

refactor embedding of images

apply suggestions

fix use of mail.css

rebase on mail-component

use ComponentCSS instead of PublicAsset

removes unrelated change

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

Labels

improvement php Pull requests that update Php code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants