voodoodyne / subethasmtp

SubEtha SMTP is a Java library for receiving SMTP mail
Other
343 stars 138 forks source link

TooMuchDataException in DATA command returns 421 code? #89

Open derelbenkoenig opened 6 years ago

derelbenkoenig commented 6 years ago

It looks like there is no catch block for the TooMuchDataException specifically, so it will be caught in the general IOException catch in Session.java, which returns "421 4.4.0 Problem attempting to execute commands. Please try again later."

I believe this exception should translate either to 552 Requested mail action aborted: exceeded storage allocation or 452 Requested action not taken: insufficient system storage

Either that, or the Exception should simply be removed from the method signature. It is redundant as the method declares that it throws IOException anyway, and the implementation will need to throw a RejectException anyway if they want to have control over what error code is returned

REME-AlarmTILT commented 6 years ago

Give a look here : https://github.com/davidmoten/subethasmtp/commit/5c2388746518afc1ca19064d1f0f1115e6ffa1ce. Maybe you should think to switch to the new fork by @davidmoten

derelbenkoenig commented 6 years ago

That's an interesting idea but I don't think it addresses my particular concern; it looks like in that fork, the TooMuchDataException is still treated as an IOException which returns with the SMTP error code of 421, while I was suggesting 452 or 552 for too much data.