nodemailer / wildduck

Opinionated email server
https://wildduck.email/
European Union Public License 1.2
1.89k stars 263 forks source link

Feature Request: Ability to pass custom IMAP response codes (instead of defaulting to `TEMPFAIL` for everything) #707

Closed titanism closed 2 months ago

titanism commented 2 months ago

For example, if locking was taking place and a lock couldn't be acquired, it would be nice if we could send mail clients a response code of INUSE as per https://datatracker.ietf.org/doc/rfc5530/.

In almost all cases, if an err occurs, it will use this to send to the client:

                    return callback(null, {
                        response: 'NO',
                        code: 'TEMPFAIL'
                    });

Perhaps we detect if err.code is one of the enumerable values (and same for response, and that both are uppercased exact matches, then we should use those instead?

cc @andris9

titanism commented 2 months ago

Closing as we can just catch errors with try/catch and return fn(null, 'SOMECODE') if needed.