') === '"Default \\"Cloud\\"" ', 'The Mailgun sender header was not rebuilt from the default title and configured mailbox.' ); $invalidWasRejected = false; try { MailSenderIdentity::mailbox("sender@example.com\r\nBcc: victim@example.com"); } catch (\InvalidArgumentException $exception) { $invalidWasRejected = true; } expectMailSenderIdentity($invalidWasRejected, 'A header-injection sender value was not rejected.'); $mailgunSource = file_get_contents(dirname(__DIR__) . '/app/Services/Mail/Mailgun.php'); expectMailSenderIdentity( is_string($mailgunSource) && str_contains($mailgunSource, 'MailSenderIdentity::header'), 'Mailgun does not use the shared sender identity.' ); echo 'Mail sender identity checks passed.' . PHP_EOL; }