Skip to content

Commit d41e2f0

Browse files
authored
Handle SmtpResponseException in DataCommand (#258)
Added a catch block for SmtpResponseException in DataCommand to return false when this exception occurs, improving error handling during SMTP data processing.
1 parent 2e280a4 commit d41e2f0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Src/SmtpServer/Protocol/DataCommand.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,14 @@ await context.Pipe.Input.ReadDotBlockAsync(
5858

5959
await context.Pipe.Output.WriteReplyAsync(response, cancellationToken).ConfigureAwait(false);
6060
}
61+
catch (SmtpResponseException)
62+
{
63+
return false;
64+
}
6165
catch (Exception)
6266
{
6367
await context.Pipe.Output.WriteReplyAsync(new SmtpResponse(SmtpReplyCode.TransactionFailed), cancellationToken).ConfigureAwait(false);
68+
return false;
6469
}
6570

6671
return true;

0 commit comments

Comments
 (0)