@@ -313,7 +313,7 @@ private async Task ProcessMailFromAsync(SmtpCommand command)
313313 bool canAccept = await _configuration . MailboxFilter . CanAcceptFromAsync ( this , mailFrom , messageSize ) . ConfigureAwait ( false ) ;
314314 if ( ! canAccept )
315315 {
316- await SendResponseAsync ( new SmtpResponse ( 550 , "Sender rejected" ) ) . ConfigureAwait ( false ) ;
316+ await SendResponseAsync ( SmtpResponse . SenderRejected ) . ConfigureAwait ( false ) ;
317317 return ;
318318 }
319319 }
@@ -350,7 +350,7 @@ private async Task ProcessRcptToAsync(SmtpCommand command)
350350
351351 if ( _recipients . Count >= _configuration . MaxRecipients )
352352 {
353- await SendResponseAsync ( new SmtpResponse ( 452 , "Too many recipients" ) ) . ConfigureAwait ( false ) ;
353+ await SendResponseAsync ( SmtpResponse . TooManyRecipients ) . ConfigureAwait ( false ) ;
354354 return ;
355355 }
356356
@@ -360,7 +360,7 @@ private async Task ProcessRcptToAsync(SmtpCommand command)
360360 bool canDeliver = await _configuration . MailboxFilter . CanDeliverToAsync ( this , rcptTo , _mailFrom ?? string . Empty ) . ConfigureAwait ( false ) ;
361361 if ( ! canDeliver )
362362 {
363- await SendResponseAsync ( new SmtpResponse ( 550 , "Recipient rejected" ) ) . ConfigureAwait ( false ) ;
363+ await SendResponseAsync ( SmtpResponse . RecipientRejected ) . ConfigureAwait ( false ) ;
364364 return ;
365365 }
366366 }
@@ -517,7 +517,7 @@ private async Task ProcessStartTlsAsync(CancellationToken cancellationToken)
517517 return ;
518518 }
519519
520- await SendResponseAsync ( new SmtpResponse ( 220 , "Ready to start TLS" ) ) . ConfigureAwait ( false ) ;
520+ await SendResponseAsync ( SmtpResponse . ReadyToStartTls ) . ConfigureAwait ( false ) ;
521521
522522 try
523523 {
@@ -557,7 +557,7 @@ private async Task ProcessAuthAsync(SmtpCommand command, CancellationToken cance
557557
558558 if ( ! IsSecure && ! _configuration . AllowPlainTextAuthentication )
559559 {
560- await SendResponseAsync ( new SmtpResponse ( 538 , "Encryption required for authentication" ) ) . ConfigureAwait ( false ) ;
560+ await SendResponseAsync ( SmtpResponse . EncryptionRequiredForAuth ) . ConfigureAwait ( false ) ;
561561 return ;
562562 }
563563
@@ -572,7 +572,7 @@ private async Task ProcessAuthAsync(SmtpCommand command, CancellationToken cance
572572
573573 if ( ! _configuration . AuthenticationMechanisms . Contains ( mechanism ) )
574574 {
575- await SendResponseAsync ( new SmtpResponse ( 504 , "Authentication mechanism not supported" ) ) . ConfigureAwait ( false ) ;
575+ await SendResponseAsync ( SmtpResponse . AuthMechanismNotSupported ) . ConfigureAwait ( false ) ;
576576 return ;
577577 }
578578
@@ -590,7 +590,7 @@ private async Task ProcessAuthAsync(SmtpCommand command, CancellationToken cance
590590 {
591591 IsAuthenticated = true ;
592592 AuthenticatedIdentity = result . Identity ;
593- await SendResponseAsync ( new SmtpResponse ( 235 , "Authentication successful" ) ) . ConfigureAwait ( false ) ;
593+ await SendResponseAsync ( SmtpResponse . AuthenticationSuccessful ) . ConfigureAwait ( false ) ;
594594 }
595595 else
596596 {
0 commit comments