)/', '', $string); $fromName = trim($replacedString, '" '); } return $fromName; } static public function parseFromAddress(?string $string): string { $fromAddress = ''; if ($string) { if (stripos($string, '<') !== false) { if (preg_match('/<(.*)>/', $string, $matches)) { $fromAddress = trim($matches[1]); } } else { $fromAddress = $string; } } return $fromAddress; } }