Closed niftylettuce closed 5 years ago
sizeExceeded is informational and actual behavior is up to the actual app to decide. You have to read the entire input stream as per SMTP protocol you can only respond with an error once the client terminates the message. Instead of destroying the stream, keep reading but do not process the chunks. Once message is finished, return the error.
I think that you should update the docs so that the example at https://nodemailer.com/extras/smtp-server/#using-size-extension is something like this instead:
The reason being is because the stream should stop as soon as the size is detected to be over the limit, otherwise it will parse the entire file. Correct me if I'm wrong?
Many thanks as always @andris9.