Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
688b42b
[Feature] Mail: IRSS
fhelfer Jun 18, 2026
8999ae6
[Feature] Mail: IRSS MimeMailTransport
fhelfer Jun 18, 2026
7ec6b41
[Feature] Mail: Fix DBConstants Type failing Unit Tests
fhelfer Jun 22, 2026
19c7552
[Feature] Mail: IRSS Migrate Component MailAttachement APIs
fhelfer Jul 6, 2026
472e397
[Feature] Mail: IRSS More Path-Code removals
fhelfer Jul 15, 2026
88b63db
[Feature] Mail: IRSS Review remove some comments
fhelfer Jul 15, 2026
e0f7d23
[Feature] Mail: IRSS Unit Tests
fhelfer Jul 15, 2026
3682d2a
[Feature] Mail: IRSS Unit Tests
fhelfer Jul 15, 2026
542d788
[Fix] Mail: IRSS-Stage für geplante Mails und Size-Tests
fhelfer Sep 22, 2026
3dd3c48
[Perf] Mail: IRSS-Migration zuerst neueste Anhänge
fhelfer Sep 25, 2026
e5aeefa
[Fix] Mail: IRSS-Review setLimit, Release-12-Steps und src
fhelfer Sep 29, 2026
35864cf
[Fix] Mail: IRSS Referenzzählung und Speicherlecks
fhelfer Oct 9, 2026
4d17735
[Fix] Mail: IRSS-Migration nach send_time, nur über IRSS-Helper
fhelfer Oct 9, 2026
52553b5
[Feature] Mail: Mark IRSS attachments as confidential
fhelfer Oct 12, 2026
dde8682
[Fix] Mail: Resolve the attachment pool user from the sender
fhelfer Oct 21, 2026
5040bd4
[Fix] Mail: Skip IRSS attachments whose bytes cannot be read
fhelfer Oct 21, 2026
cbce0b5
[Fix] Mail: Index attachment listings by resource id
fhelfer Oct 21, 2026
29991cd
[Fix] Mail: Ignore non-string legacy attachment filenames
fhelfer Oct 21, 2026
cb81cf6
[Test] Mail: Replace expectation-free mocks with stubs
fhelfer Oct 21, 2026
7a5275d
[Fix] Mail: Store legacy pool files under their unprefixed name
fhelfer Oct 21, 2026
49151a7
[Fix] Mail: Allow owners to open unsent attachment resources
fhelfer Oct 21, 2026
7bd9dc5
[Fix] Mail: Attach only the current user's compose resources
fhelfer Oct 21, 2026
e7b3ff3
[Fix] Mail: Abort delivery when attachment copies cannot be created
fhelfer Oct 21, 2026
6311c94
[Fix] Mail: Copy attachment directories before marking them migrated
fhelfer Oct 21, 2026
0bb74fd
[Fix] Mail: Accept only the user's pool resources in the attachment pool
fhelfer Oct 21, 2026
d376a7f
[Fix] Wiki: Pass MailAttachments to change notification mails
fhelfer Oct 21, 2026
b871aaf
[Fix] Forum: Attach the post collection only if it contains files
fhelfer Oct 21, 2026
0b331cb
[Fix] Mail: Resolve legacy pool references only for drafts and outbox…
fhelfer Oct 22, 2026
d25c563
[Fix] Mail: Address IRSS attachments by resource instead of file name
fhelfer Oct 22, 2026
c2ec27e
[Fix] Mail: Edit only own drafts and scheduled mails
fhelfer Oct 22, 2026
86cc6e5
[Docs] Mail: Describe IRSS based attachments
fhelfer Oct 22, 2026
993da3f
[Refactoring] Mail: Keep every attachment resource in exactly one col…
fhelfer Oct 22, 2026
d2e7c8a
[Fix] Mail: Release attachment collections of rejected and failed del…
fhelfer Oct 22, 2026
c23df25
[Fix] Mail: Send the new account mail attachment as attachment
fhelfer Oct 22, 2026
5729ec3
[Fix] Mail: Deny attachment access for the anonymous user
fhelfer Oct 22, 2026
0c405c8
[Refactoring] Mail: Remove unused attachment helpers
fhelfer Oct 22, 2026
39e68b5
[Refactoring] Mail: Remove the repair of earlier attachment migration…
fhelfer Oct 22, 2026
4f684c7
[Fix] Mail: Accept only collection ids as IRSS attachment values
fhelfer Oct 22, 2026
58158b1
[Fix] Mail: Resolve IRSS attachments only for mails of the user
fhelfer Oct 22, 2026
5f0ef4b
[Test] Mail: Use stubs for the IRSS and statement doubles without exp…
fhelfer Oct 22, 2026
0df137f
[Refactoring] Mail: Revert unrelated formatting changes
fhelfer Oct 22, 2026
294bcd0
[Refactoring] Mail: Remove the unused form attachment trait from the …
fhelfer Oct 22, 2026
b36a1ab
[Refactoring] Mail: Drop parentheses around new in member access
fhelfer Oct 22, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion components/ILIAS/Badge/classes/class.ilBadgeHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
use ILIAS\Notifications\Model\ilNotificationLink;
use ILIAS\Notifications\Model\ilNotificationParameter;
use ILIAS\Badge\GlobalScreen\BadgeNotificationProvider;
use ILIAS\Mail\Attachments\MailAttachments;

/**
* Class ilBadgeHandler
Expand Down Expand Up @@ -537,7 +538,7 @@ public function sendNotification(
'',
$lng->txt('badge_notification_subject'),
$ntf->composeAndGetMessage($user_id, null, 'read', true),
[]
MailAttachments::empty()
);


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

declare(strict_types=1);

use ILIAS\Mail\Attachments\MailAttachments;

/**
* Distributes calendar mail notifications
* @author Stefan Meyer <smeyer.ilias@gmx.de>
Expand Down Expand Up @@ -448,8 +450,6 @@ public function send(): void
$this->sendMail(array($user_id), true);
break;
}

$this->deleteAttachments();
}

protected function addAttachment(): void
Expand All @@ -461,18 +461,16 @@ protected function addAttachment(): void

$ics_filename = 'appointment_' . (new DateTimeImmutable('now'))->format('Ymd_His_u') . '.ics';

$attachment = new ilFileDataMail($this->getSender());
$effective_ics_filename = $attachment->storeAsAttachment(
$attachment = $this->initFileDataMail();
$rcid = $attachment->createCollectionFromContent(
$ics_filename,
$export->getExportString()
);

$this->setAttachments([$effective_ics_filename]);
}

protected function deleteAttachments(): void
{
$attachment = new ilFileDataMail($this->getSender());
$attachment->unlinkFiles($this->getAttachments());
$this->setAttachments(
$rcid !== null
? MailAttachments::fromIrss($rcid)
: MailAttachments::empty()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
use ILIAS\Cron\Job\Schedule\JobScheduleType;
use ILIAS\Cron\Job\JobResult;
use ILIAS\Cron\CronJob;
use ILIAS\Mail\Attachments\MailAttachments;

class ilTimingsCronReminder extends CronJob
{
Expand Down Expand Up @@ -309,7 +310,7 @@ protected function sendExceededMail(int $user_id, array $ref_ids, string $mail_b
'',
$this->user_lang->txt('timings_cron_reminder_exceeded_subject'),
$mail_body,
[],
MailAttachments::empty(),
true
);
$this->log->debug('...mail send for user ' . $user_id . ' to mail ' . $login . ' has exceeded timings for ' . $mail_body);
Expand All @@ -334,7 +335,7 @@ protected function sendFreshlyStartedMail(int $user_id, array $ref_ids, string $
'',
$this->user_lang->txt('timings_cron_reminder_started_subject'),
$mail_body,
[],
MailAttachments::empty(),
true
);
$this->log->debug('...mail send for user ' . $user_id . ' to mail ' . $login . ' has freshly started timings for ' . $mail_body);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

namespace ILIAS\EmployeeTalk\Notification;

use ILIAS\Mail\Attachments\MailAttachments;

class Notification
{
protected \ilObjUser $to;
Expand Down Expand Up @@ -117,10 +119,10 @@ public function send(): void
}

$attachment_name = 'appointments.ics';
$attachment->storeAsAttachment(
$attachment_name,
$this->attachment
);
$rcid = $attachment->createCollectionFromContent($attachment_name, $this->attachment);
$attachments = $rcid !== null
? MailAttachments::fromIrss($rcid)
: MailAttachments::empty();

$mail = new \ilMail(ANONYMOUS_USER_ID);
$mail->enqueue(
Expand All @@ -129,10 +131,8 @@ public function send(): void
'',
$subject,
$notif->composeAndGetMessage($this->to->getId(), null, '', true),
[$attachment_name]
$attachments
);

$attachment->unlinkFile($attachment_name);
}

protected function getTalkGoto(): string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
*
*********************************************************************/

use ILIAS\Mail\Attachments\MailAttachments;

/**
*
* TODO: import/export reminder data with the exercise/assignment.
Expand Down Expand Up @@ -561,7 +563,7 @@ protected function sendReminders(array $reminders): int
"",
$subject,
$message,
array()
MailAttachments::empty()
);
}

Expand Down
26 changes: 8 additions & 18 deletions components/ILIAS/Exercise/classes/class.ilObjExercise.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
use ILIAS\Filesystem\Exception\IOException;
use ILIAS\Exercise\InternalService;
use ILIAS\Exercise\Assignment\Mandatory\MandatoryAssignmentsManager;
use ILIAS\Mail\Attachments\MailAttachments;
use ILIAS\ResourceStorage\Identification\ResourceCollectionIdentification;

/**
* Class ilObjExercise
Expand Down Expand Up @@ -454,17 +456,11 @@ public function sendAssignment(ilExAssignment $a_ass, array $a_members): void

// instruction files
$if = $this->service->domain()->assignment()->instructionFiles($a_ass->getId());
$files = $if->getFiles();
$file_names = [];
if (count($files) > 0) {
$mfile_obj = new ilFileDataMail($GLOBALS['DIC']['ilUser']->getId());
foreach ($if->getFiles() as $file) {
$file_names[] = $file["name"];
$mfile_obj->storeAsAttachment(
$file["name"],
$if->getStream($file["rid"])->getContents()
);
}
$attachments = MailAttachments::empty();
if ($if->getFiles() !== []) {
$attachments = MailAttachments::fromIrss(
new ResourceCollectionIdentification($if->getCollectionIdString())
);
}

// recipients
Expand All @@ -485,16 +481,10 @@ public function sendAssignment(ilExAssignment $a_ass, array $a_members): void
"",
$subject,
$body,
$file_names
$attachments
);
unset($tmp_mail_obj);

// remove tmp files
if (count($file_names) && $mfile_obj) {
$mfile_obj->unlinkFiles($file_names);
unset($mfile_obj);
}

// set recipients mail status
foreach ($a_members as $member_id) {
$member_status = $a_ass->getMemberStatus($member_id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@

declare(strict_types=1);

use ILIAS\Mail\Attachments\MailAttachments;
use ILIAS\ResourceStorage\Identification\ResourceCollectionIdentification;

/**
* Class ilForumCronNotificationDataProvider
* @author Nadia Matuschek <nmatuschek@databay.de>
Expand Down Expand Up @@ -46,6 +49,7 @@ class ilForumCronNotificationDataProvider implements ilForumNotificationMailData
private readonly string $import_name;
/** @var list<string> */
private array $attachments = [];
private ?MailAttachments $mail_attachments = null;
/** @var int[] */
private array $cron_recipients = [];
private readonly int $post_update_user_id;
Expand Down Expand Up @@ -105,14 +109,28 @@ protected function read(): void

private function readAttachments(): void
{
if (ilForumProperties::isSendAttachmentsByMailEnabled()) {
$fileDataForum = new ilFileDataForum($this->getObjId(), $this->getPostId());
$filesOfPost = $fileDataForum->getFilesOfPost();
if (!ilForumProperties::isSendAttachmentsByMailEnabled()) {
return;
}

$fileDataForum = new ilFileDataForum($this->getObjId(), $this->getPostId());
foreach ($fileDataForum->getFilesOfPost() as $attachment) {
$this->attachments[] = $attachment['name'];
}

if ($this->attachments === []) {
return;
}

foreach ($filesOfPost as $attachment) {
$this->attachments[] = $attachment['name'];
}
$post = new ilForumPost($this->getPostId());
$rcid_string = $post->getRCID();
if ($rcid_string === '' || $rcid_string === ilForumPost::NO_RCID) {
return;
}

$this->mail_attachments = MailAttachments::fromIrss(
new ResourceCollectionIdentification($rcid_string)
);
}

public function addRecipient(int $user_id): void
Expand Down Expand Up @@ -216,6 +234,11 @@ public function getAttachments(): array
return $this->attachments;
}

public function getMailAttachments(): MailAttachments
{
return $this->mail_attachments ?? MailAttachments::empty();
}

public function getPosDisplayUserId(): int
{
return $this->pos_display_user_id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

declare(strict_types=1);

use ILIAS\Mail\Attachments\MailAttachments;

/**
* @author Niels Theen <ntheen@databay.de>
*/
Expand Down Expand Up @@ -360,7 +362,7 @@ private function createMailValueObjectsWithAttachments(
'',
ilStr::strLen($subjectText) > 255 ? ilStr::substr($subjectText, 0, 255) : $subjectText,
$bodyText,
$this->provider->getAttachments(),
$this->provider->getMailAttachments(),
false,
false
);
Expand Down Expand Up @@ -393,7 +395,7 @@ private function createMailValueObjectWithoutAttachments(
'',
ilStr::strLen($subjectText) > 255 ? ilStr::substr($subjectText, 0, 255) : $subjectText,
$bodyText,
[],
MailAttachments::empty(),
false,
false
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@

declare(strict_types=1);

use ILIAS\Mail\Attachments\MailAttachments;
use ILIAS\ResourceStorage\Identification\ResourceCollectionIdentification;

/**
* Class ilForumNotificationDataProvider
* @author Nadia Matuschek <nmatuschek@databay.de>
Expand All @@ -35,6 +38,7 @@ class ilForumNotificationDataProvider implements ilForumNotificationMailData
protected string $thread_title = '';
/** @var array<string, string> */
protected array $attachments = [];
private ?MailAttachments $mail_attachments = null;
private readonly ilDBInterface $db;
private readonly ilAccessHandler $access;
private readonly ilObjUser $user;
Expand Down Expand Up @@ -148,6 +152,11 @@ public function getAttachments(): array
return $this->attachments;
}

public function getMailAttachments(): MailAttachments
{
return $this->mail_attachments ?? MailAttachments::empty();
}

public function getPosUserAlias(): string
{
return $this->objPost->getUserAlias();
Expand Down Expand Up @@ -314,17 +323,27 @@ public function determineClosestContainer(int $frm_ref_id): ?ilObject

private function readAttachments(): void
{
if (ilForumProperties::isSendAttachmentsByMailEnabled()) {
$fileDataForum = new ilFileDataForum($this->getObjId(), $this->objPost->getId());
$filesOfPost = $fileDataForum->getFilesOfPost();
if (!ilForumProperties::isSendAttachmentsByMailEnabled()) {
return;
}

$fileDataMail = new ilFileDataMail(ANONYMOUS_USER_ID);
$fileDataForum = new ilFileDataForum($this->getObjId(), $this->objPost->getId());
foreach ($fileDataForum->getFilesOfPost() as $attachment) {
$this->attachments[$attachment['path']] = $attachment['name'];
}

foreach ($filesOfPost as $attachment) {
$this->attachments[$attachment['path']] = $attachment['name'];
$fileDataMail->copyAttachmentFile($attachment['path'], $attachment['name']);
}
if ($this->attachments === []) {
return;
}

$rcid_string = $this->objPost->getRCID();
if ($rcid_string === '' || $rcid_string === ilForumPost::NO_RCID) {
return;
}

$this->mail_attachments = MailAttachments::fromIrss(
new ResourceCollectionIdentification($rcid_string)
);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ protected function appendAttachments(): void
$this->appendBody($this->getLanguageText('attachment') . ': ' . $attachment . "\n");
}
$this->appendBody($this->getBlockBorder() . "\n");
$this->setAttachments($this->provider->getAttachments());
$this->setAttachments($this->provider->getMailAttachments());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

declare(strict_types=1);

use ILIAS\Mail\Attachments\MailAttachments;

/**
* Interface ilForumNotificationMailData
* @author Nadia Matuschek <nmatuschek@databay.de>
Expand Down Expand Up @@ -71,5 +73,7 @@ public function getCensorshipComment(): string;

public function getAttachments(): array;

public function getMailAttachments(): MailAttachments;

public function getDeletedBy(): string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
*
*********************************************************************/

use ILIAS\Mail\Attachments\MailAttachments;

/**
* Class ilLearningModuleNotification class
*
Expand Down Expand Up @@ -109,7 +111,7 @@ public function send(): void
"",
$subject,
$message,
[]
MailAttachments::empty()
);
}
}
Expand Down
Loading
Loading