If I throw an error inside the smtp:data hook, the client stuck and after a long time (~10 minutes) exits for timeout instead of the actual message I want to return:
Error: Timeout
at SMTPConnection._onTimeout (/home/matteo/src/test/nodemailer/node_modules/nodemailer/lib/smtp-connection/index.js:847:30)
at Socket.SMTPConnection._onSocketTimeout (/home/matteo/src/test/nodemailer/node_modules/nodemailer/lib/smtp-connection/index.js:193:44)
at Socket.emit (events.js:400:28)
at Socket._onTimeout (net.js:495:8)
at listOnTimeout (internal/timers.js:557:17)
at processTimers (internal/timers.js:500:7) {
code: 'ETIMEDOUT',
command: 'CONN'
}
It is necessary to close (destroy) the stream to unlock the process and forward the error message correctly to the client.
UPDATE: 2022-02-17
I also added the sessionId (id) to all logs for legal compliance.
If I throw an error inside the smtp:data hook, the client stuck and after a long time (~10 minutes) exits for timeout instead of the actual message I want to return:
This is the client (using nodemailer):
It is necessary to close (destroy) the stream to unlock the process and forward the error message correctly to the client.
UPDATE: 2022-02-17
I also added the sessionId (id) to all logs for legal compliance.