Fix error messages if PHP's mail() function fails

This commit is contained in:
Markus Bauer 2017-01-17 19:42:57 +01:00
parent 541fb03438
commit 9b13381b0a

View file

@ -72,12 +72,12 @@ class MailTransport extends AbstractTransport {
//@codingStandardsIgnoreStart
if (!@mail($to, $subject, $message, $headers)) {
$error = error_get_last();
$msg = 'Could not send email: ' . isset($error['message']) ? $error['message'] : 'unknown';
$msg = 'Could not send email: ' . (isset($error['message']) ? $error['message'] : 'unknown');
throw new SocketException($msg);
}
} elseif (!@mail($to, $subject, $message, $headers, $params)) {
$error = error_get_last();
$msg = 'Could not send email: ' . isset($error['message']) ? $error['message'] : 'unknown';
$msg = 'Could not send email: ' . (isset($error['message']) ? $error['message'] : 'unknown');
//@codingStandardsIgnoreEnd
throw new SocketException($msg);
}