diff --git a/sources/Core/Email/Transport/SymfonyPHPMailTransport.php b/sources/Core/Email/Transport/SymfonyPHPMailTransport.php index 7f2334ff25..7881ba4299 100644 --- a/sources/Core/Email/Transport/SymfonyPHPMailTransport.php +++ b/sources/Core/Email/Transport/SymfonyPHPMailTransport.php @@ -20,7 +20,7 @@ class SymfonyPHPMailTransport extends AbstractTransport { $oHeaders = $oRawEmail->getHeaders(); - return $oHeaders->get('To')->getBodyAsString(); + return $oHeaders->get('To') ? $oHeaders->get('To')->getBodyAsString() : ''; } /** diff --git a/tests/php-unit-tests/unitary-tests/sources/core/Email/Transport/SymfonyPHPMailTransportTest.php b/tests/php-unit-tests/unitary-tests/sources/core/Email/Transport/SymfonyPHPMailTransportTest.php new file mode 100644 index 0000000000..97f1db109d --- /dev/null +++ b/tests/php-unit-tests/unitary-tests/sources/core/Email/Transport/SymfonyPHPMailTransportTest.php @@ -0,0 +1,22 @@ +from('sender@example.com') + ->cc('cc1@example.com', 'cc2@example.com') + ->text('Body'); + + $oTransport = new SymfonyPHPMailTransport(); + + $oTransport->prepareTo($oEmail); + $this->assertTrue(true); // if no error is thrown, the test passes + + } +}