Closed
Description
Description
It would be nice to have error codes in the TransportException, if the state of the transport is clear.
In our application it is a valid flow to get a 535, if the credentials in cache are not valid anymore -> we trigger a cache update. Currently we have to parse the code from the error message, but the occurance of a 535 in the transport is clear and the error code could be added easily (see example below).
Example
EsmtpTransport.php [186-195]:
...
if (!$authNames) {
throw new TransportException(sprintf('Failed to find an authenticator supported by the SMTP server, which currently supports: "%s".', implode('", "', $modes)),504); //Unrecognized authentication type
}
$message = sprintf('Failed to authenticate on SMTP server with username "%s" using the following authenticators: "%s".', $this->username, implode('", "', $authNames));
foreach ($errors as $name => $error) {
$message .= sprintf(' Authenticator "%s" returned "%s".', $name, $error);
}
throw new TransportException($message,535); //Authentication credentials invalid
...