Issue Bug Closed

#108629An error when sending an email via spooler deletes the mail after a failed sending atempt.

Tobias Gülzow 01/14/26, 11:33 updated 03/31/26, 08:59

Description

Regression: Complex Emails Failing in File Spool

A regression caused the FileSpool to reject and delete emails containing complex MIME structures (attachments, embedded files, or AbstractPart objects). This resulted in valid messages being lost from the mail queue.

Symptoms

- Emails with attachments not being sent
- Error logs showing “disallowed class object” messages
- Messages disappearing from the spool directory

Fix

This has been resolved. Failed messages are now preserved with an “.invalid” extension for debugging, and proper MIME part handling has been restored.

—-

Original Report

Hi everyone.

The spooler will delete an email that failed to get send. This was introduced with the latest security patch.

When:
  • TYPO3 tries to send an email
  • and sending the email fails for any reason
  • a log entry “Serialized message from {fileName} was rejected, because it contains a disallowed class object.” will be created
  • and the mail will be deleted

*Possible reason for failing to send a message*
We get regularly a `Expected response code “250/251/252” but got code “451”, with message “451 4.3.0 Error: queue file write error”.`
It is generated here: https://github.com/symfony/mailer/blob/v8.0.3/Transport/Smtp/SmtpTransport.php#L331
The mail server is not ours. It is the mail server of the customer, and we have no access to it.

What is happening inside the code
  1. The message gets deserialized here: https://github.com/TYPO3/typo3/blob/v13.4.23/typo3/sysext/core/Classes/Mail/FileSpool.php#L146
  2. The message then gets send here: https://github.com/TYPO3/typo3/blob/v13.4.23/typo3/sysext/core/Classes/Mail/FileSpool.php#L159
  3. When a \Throwable is thrown while sending the mail, it then will get caught here: https://github.com/TYPO3/typo3/blob/v13.4.23/typo3/sysext/core/Classes/Mail/FileSpool.php#L170
  4. The actual error message will be discarded here: https://github.com/TYPO3/typo3/blob/v13.4.23/typo3/sysext/core/Classes/Mail/FileSpool.php#L172
  5. The mail will then get deleted here: https://github.com/TYPO3/typo3/blob/v13.4.23/typo3/sysext/core/Classes/Mail/FileSpool.php#L176

*Proposed solution*
Move the sending of the try/catch clause.

Tobi

Reviews 3

History 427

Show 12 earlier messages
  1. Markus Klein commented and changed status New Accepted priority Should have Must have <span data-processor="relativetime" data-value="2026-01-14T13:39:02+00:00" > 01/14/26, 13:39 </span>

    The reason is that the old code relies on dying with the exception from the transport, so the .sending file persists (and can be retried).

  2. Gerrit Code Review pushed patch set 1 for main to change 92329 status Accepted Under Review <span data-processor="relativetime" data-value="2026-01-14T13:43:08+00:00" > 01/14/26, 13:43 </span>

  1. Markus Klein commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2026-01-19T09:45:08+00:00" > 01/19/26, 09:45 </span>

    Applied in changeset commit:e54ef9fe32f49e9f64310c754a234f5ca4330f3e.