feat: implement global autoresponder plugin

This commit is contained in:
Marek Miklewicz
2026-06-02 19:19:00 +02:00
commit 6f989af278
62 changed files with 2018 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
<?php
declare(strict_types=1);
require_once PLUGIN_ROOT . '/exec/lib/MailSender.php';
test('mail sender rejects subject header injection and builds utf8 message', function (): void {
try {
MailSender::buildMessage('from@example.com', 'to@example.com', "Bad\nSubject", 'Body');
} catch (InvalidArgumentException $e) {
assert_contains('subject', strtolower($e->getMessage()));
}
$message = MailSender::buildMessage('from@example.com', 'to@example.com', 'Temat', "Treść\nDruga linia");
assert_contains('Auto-Submitted: auto-replied', $message);
assert_contains('Content-Type: text/plain; charset=UTF-8', $message);
assert_contains("Subject: =?UTF-8?B?", $message);
});