Skip to content

Commit

Permalink
Do not impose an unauthenticated command limit when auth is optional
Browse files Browse the repository at this point in the history
Proposed as a fix to nodemailer#161
  • Loading branch information
immjs authored Oct 24, 2023
1 parent ce14fcc commit 72db181
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/smtp-connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ class SMTPConnection extends EventEmitter {
}

// block users that try to fiddle around without logging in
if (!this.session.user && this._isSupported('AUTH') && commandName !== 'AUTH' && this._maxAllowedUnauthenticatedCommands !== false) {
if (!this.session.user && this._isSupported('AUTH') && !this._server.options.authOptional && commandName !== 'AUTH' && this._maxAllowedUnauthenticatedCommands !== false) {
this._unauthenticatedCommands++;
if (this._unauthenticatedCommands >= this._maxAllowedUnauthenticatedCommands) {
return this.send(421, 'Error: too many unauthenticated commands');
Expand Down

0 comments on commit 72db181

Please sign in to comment.