Send a test mail from the admin and log why delivery failed

Form submissions marked as not sent gave no reason: the transport
exception was swallowed. Every send now goes through MailCheck, which
logs the server's answer and a hint in German to var/log/mail.log
(server lines only, no credentials). The system screen shows the mail
route, sends a test mail to any address and lists recent attempts
(ADR 121).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
kantarciandClaude Opus 5.5 committed 2026-10-12 20:29:36 +02:00
1 parent 090436233d
commit d313156c73
11 files changed
+501 -13

No files matched your search

+5 -11
View File
@@ -8,11 +8,10 @@ use App\Content\MenuRepository;
use App\Content\PageRepository;
use App\Content\SiteSettings;
use App\Content\Turnstile;
use App\Ops\MailCheck;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Mailer\Exception\TransportExceptionInterface;
use Symfony\Component\Mailer\MailerInterface;
use Symfony\Component\Mime\Email;
use Symfony\Component\Routing\Attribute\Route;
@@ -29,7 +28,7 @@ final class FormController extends AbstractController
private PageRepository $pages,
private MenuRepository $menus,
private SiteSettings $settings,
private MailerInterface $mailer,
private MailCheck $mail,
private Turnstile $turnstile,
private string $secret,
private string $siteOrigin,
@@ -127,15 +126,10 @@ final class FormController extends AbstractController
if ('' !== $replyTo && '' !== ($values[$replyTo] ?? '')) {
$email->replyTo($values[$replyTo]);
}
try {
$this->mailer->send($email);
return true;
} catch (TransportExceptionInterface) {
// The submission is already stored, so a broken mail setup loses no enquiry.
// It stays marked as undelivered and is visible in the administration.
return false;
}
// The submission is already stored, so a broken mail setup loses no enquiry. It stays
// marked as undelivered, and var/log/mail.log says why (System -> E-Mail-Versand).
return $this->mail->send($email, 'Formular '.$form['slug'])['ok'];
}
/**