diff --git a/typo3/sysext/core/Classes/Mail/FileSpool.php b/typo3/sysext/core/Classes/Mail/FileSpool.php
index 32a6aa044b8386025351577d4e8c81bd9231254c..3aa782b8bedf2f162d351317f7753e38ed088757 100644
--- a/typo3/sysext/core/Classes/Mail/FileSpool.php
+++ b/typo3/sysext/core/Classes/Mail/FileSpool.php
@@ -123,7 +123,7 @@ class FileSpool extends AbstractTransport implements DelayedTransportInterface,
     public function recover(int $timeout = 900): void
     {
         foreach (new DirectoryIterator($this->path) as $file) {
-            $file = $file->getRealPath();
+            $file = (string)$file->getRealPath();
 
             if (substr($file, -16) == '.message.sending') {
                 $lockedtime = filectime($file);
@@ -144,7 +144,7 @@ class FileSpool extends AbstractTransport implements DelayedTransportInterface,
         $count = 0;
         $time = time();
         foreach ($directoryIterator as $file) {
-            $file = $file->getRealPath();
+            $file = (string)$file->getRealPath();
 
             if (substr($file, -8) != '.message') {
                 continue;
@@ -152,7 +152,7 @@ class FileSpool extends AbstractTransport implements DelayedTransportInterface,
 
             /* We try a rename, it's an atomic operation, and avoid locking the file */
             if (rename($file, $file . '.sending')) {
-                $message = unserialize(file_get_contents($file . '.sending'), [
+                $message = unserialize((string)file_get_contents($file . '.sending'), [
                     'allowedClasses' => [
                         RawMessage::class,
                         Message::class,
@@ -247,13 +247,13 @@ class FileSpool extends AbstractTransport implements DelayedTransportInterface,
         $result = '';
         $directoryIterator = new DirectoryIterator($this->path);
         foreach ($directoryIterator as $file) {
-            $file = $file->getRealPath();
+            $file = (string)$file->getRealPath();
 
             if (substr($file, -8) != '.message') {
                 continue;
             }
 
-            $result .= file_get_contents($file) . "\n";
+            $result .= (string)file_get_contents($file) . "\n";
         }
         return $result;
     }
diff --git a/typo3/sysext/core/Classes/Mail/MailMessage.php b/typo3/sysext/core/Classes/Mail/MailMessage.php
index 2952fdb9936702f890a970635aa5b9ef263afbb8..0975b81d0329ac51aecbdfaba3c764b2caeeb8df 100644
--- a/typo3/sysext/core/Classes/Mail/MailMessage.php
+++ b/typo3/sysext/core/Classes/Mail/MailMessage.php
@@ -241,7 +241,7 @@ class MailMessage extends Email
     /**
      * Converts address from [email, name] into Address objects.
      *
-     * @param array<int,mixed> $args
+     * @param mixed ...$args
      * @return Address[]
      */
     protected function convertNamedAddress(...$args): array
diff --git a/typo3/sysext/core/Classes/Mail/Mailer.php b/typo3/sysext/core/Classes/Mail/Mailer.php
index b0a9bdf3383eb926228375d8ed8d904c9102619f..1121f4398c95575446c063150b425c6d83f63aa7 100644
--- a/typo3/sysext/core/Classes/Mail/Mailer.php
+++ b/typo3/sysext/core/Classes/Mail/Mailer.php
@@ -114,7 +114,7 @@ class Mailer implements MailerInterface
                     if ($address === 0) {
                         $replyTo = new Address($replyTo[$address]);
                     } else {
-                        $replyTo = new Address($address, reset($replyTo));
+                        $replyTo = new Address((string)$address, reset($replyTo));
                     }
                     $message->replyTo($replyTo);
                 }
diff --git a/typo3/sysext/core/Classes/Mail/Rfc822AddressesParser.php b/typo3/sysext/core/Classes/Mail/Rfc822AddressesParser.php
index 72d7972b00f55089400abd4ccb5aacc857347927..957adca48840c02072ae9e7bd97c62424a282bfc 100644
--- a/typo3/sysext/core/Classes/Mail/Rfc822AddressesParser.php
+++ b/typo3/sysext/core/Classes/Mail/Rfc822AddressesParser.php
@@ -179,20 +179,20 @@ class Rfc822AddressesParser
         $this->error = null;
         $this->index = null;
         // Unfold any long lines in $this->address.
-        $this->address = preg_replace('/\\r?\\n/', '
+        $this->address = (string)preg_replace('/\\r?\\n/', '
 ', $this->address);
-        $this->address = preg_replace('/\\r\\n(\\t| )+/', ' ', $this->address);
+        $this->address = (string)preg_replace('/\\r\\n(\\t| )+/', ' ', $this->address);
         while ($this->address = $this->_splitAddresses($this->address)) {
         }
         if ($this->address === false || isset($this->error)) {
-            throw new \InvalidArgumentException($this->error, 1294681466);
+            throw new \InvalidArgumentException((string)$this->error, 1294681466);
         }
         // Validate each address individually.  If we encounter an invalid
         // address, stop iterating and return an error immediately.
         foreach ($this->addresses as $address) {
             $valid = $this->_validateAddress($address);
             if ($valid === false || isset($this->error)) {
-                throw new \InvalidArgumentException($this->error, 1294681467);
+                throw new \InvalidArgumentException((string)$this->error, 1294681467);
             }
             $this->structure = array_merge($this->structure, $valid);
         }
@@ -223,7 +223,7 @@ class Rfc822AddressesParser
             return false;
         }
         // Split the string based on the above ten or so lines.
-        $parts = explode($split_char, $address);
+        $parts = explode($split_char, $address) ?: [];
         $string = $this->_splitCheck($parts, $split_char);
         // If a group...
         if ($is_group) {
@@ -376,7 +376,7 @@ class Rfc822AddressesParser
      */
     protected function _hasUnclosedBracketsSub($string, &$num, $char)
     {
-        $parts = explode($char, $string);
+        $parts = explode($char, $string) ?: [];
         $partsCounter = count($parts);
         for ($i = 0; $i < $partsCounter; $i++) {
             if (substr($parts[$i], -1) === '\\' || $this->_hasUnclosedQuotes($parts[$i])) {
@@ -535,9 +535,9 @@ class Rfc822AddressesParser
     protected function _validateQuotedString($qstring)
     {
         // Leading and trailing "
-        $qstring = substr($qstring, 1, -1);
+        $qstring = (string)substr($qstring, 1, -1);
         // Perform check, removing quoted characters first.
-        return !preg_match('/[\\x0D\\\\"]/', preg_replace('/\\\\./', '', $qstring));
+        return !preg_match('/[\\x0D\\\\"]/', (string)preg_replace('/\\\\./', '', $qstring));
     }
 
     /**