Closed famod closed 2 years ago
Thank you for the report. :)
The reply code has defined meanings by the specification, and if the SMTP server supports enhanced status code, there are sub codes defined as well in https://datatracker.ietf.org/doc/html/rfc3463#section-2.
I would like to introduce an explicit exception with the reply code
and enhanced status code
(if applicable) for all transient(4xx)/permanent(5xx) failures. Please let me know if this cannot fulfill your needs. :)
@gaol Sorry for the late feedback!
I would like to introduce an explicit exception with the
reply code
andenhanced status code
(if applicable) for all transient(4xx)/permanent(5xx) failures.
Ideally, a client should not need to interpret specific numbers, but should instead receive something like RecipientAddressNotAcceptedException
.
If that's what you meant then I'm fine! :smile
I'll try to have a look at the PR.
@famod np :)
Ideally, a client should not need to interpret specific numbers, but should instead receive something like RecipientAddressNotAcceptedException. If that's what you meant then I'm fine! :smile
Actually no, SMTP specifies many reply codes on failures, and some SMTP servers may extend it, it is not feasible to distinguish them all and throw different exceptions accordingly in this client IMO.
What I want to do is a way to know the failure code(should be stable approach), and with enhanced code support(not yet), we can know what categories the failure falls to, like: Address
, Mailbox
, Mail system
, etc. Applications can decide what to do according to the failure category, something like RecipientAddressNotAcceptedException
is too specific IMO.
Describe the feature
In case of an invalid recipient address,
vertx-mail-client
currently just throws something like:NoStackTraceThrowable: recipient address not accepted: 450 4.1.2 <foo@invalid.invalid>: Recipient address rejected: Domain not found
NoStackTraceThrowable: recipient address not accepted: 556 5.1.10 <foo@example.com>: Recipient address rejected: Domain example.com does not accept mail (nullMX)
Since
NoStackTraceThrowable
is generic, an application that has to react to this specifically will need to parse the execption message, e.g. for "Recipient address rejected". Such a string can change without further notice or detection, making this a fragile solution.It would be helpful if an explicit exception would be thrown for those cases.
Use cases
Detection of invalid email addresses to e.g. notify someone or to display a specific error message in UI.