Get email not send errors

How can I get the error message for the mail() function? You can use error_get_last()when mail() returns false. $success = mail(‘[email protected]’, ‘My Subject’, $message); if (!$success) { $errorMessage = error_get_last()[‘message’]; } With print_r(error_get_last()), you get something like this: [type] => 2 [message] => mail(): Failed to connect to mailserver at “x.x.x.x” port 25, verify your … Read moreGet email not send errors