Skip to content

Commit 42c6379

Browse files
author
Winni Neessen
committed
Move delivery status update after writer close check
Relocated the `isDelivered` flag update to occur after the writer's close method validation. This ensures that the message delivery status is only marked as true if no errors arise during the writer close process. This showed up in the new test cases that covered errors on closing the DATA channel. This can already happen before the first byte is sent to the server. Therefore isDelivered should be set after a successful close.
1 parent f5279cd commit 42c6379

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

client.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,14 +1261,13 @@ func (c *Client) sendSingleMsg(message *Msg) error {
12611261
affectedMsg: message,
12621262
}
12631263
}
1264-
message.isDelivered = true
1265-
12661264
if err = writer.Close(); err != nil {
12671265
return &SendError{
12681266
Reason: ErrSMTPDataClose, errlist: []error{err}, isTemp: isTempError(err),
12691267
affectedMsg: message,
12701268
}
12711269
}
1270+
message.isDelivered = true
12721271

12731272
if err = c.Reset(); err != nil {
12741273
return &SendError{

0 commit comments

Comments
 (0)