Skip to content

Fix bulk mail delivery to return actual message count#146

Merged
linyows merged 1 commit intomainfrom
fix-bulk-sent-count
Jan 13, 2026
Merged

Fix bulk mail delivery to return actual message count#146
linyows merged 1 commit intomainfrom
fix-bulk-sent-count

Conversation

@linyows
Copy link
Owner

@linyows linyows commented Jan 13, 2026

Summary

Fixed a bug in bulk mail delivery where DeliverWithResult() was returning the number of sessions instead of the actual number of messages sent.

Problem

When using SMTP bulk delivery with different session and message counts (e.g., session: 1, message: 5), the Sent field in DeliveryResult would incorrectly report 1 (the session count) instead of 5 (the actual messages sent).

Changes

  • Modified Bulk.Send() to return (int, error) to report the number of messages sent
  • Updated DeliverWithResult() to aggregate message counts from all sessions
  • Added Sessions field to DeliveryResult struct to track session count separately
  • Added comprehensive unit tests in bulk_test.go covering various scenarios

Test Results

All tests pass:

=== RUN   TestBulkDeliverWithResult
--- PASS: TestBulkDeliverWithResult (0.43s)
=== RUN   TestBulkSend
--- PASS: TestBulkSend (0.42s)
PASS

🤖 Generated with Claude Code

…ion count

Previously, DeliverWithResult() returned the number of sessions as the
Sent count, not the actual number of messages sent. This caused issues
when session count differed from message count (e.g., session=1, message=5
would report Sent=1 instead of Sent=5).

Changes:
- Modified Bulk.Send() to return (int, error) instead of just error
- Updated DeliverWithResult() to aggregate message counts from each session
- Added Sessions field to DeliveryResult struct to track session count separately
- Added comprehensive unit tests in bulk_test.go

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@github-actions

This comment has been minimized.

@github-actions
Copy link

Code Metrics Report

main (8129e35) #146 (d6b7e33) +/-
Coverage 48.5% 48.7% +0.2%
Code to Test Ratio 1:1.1 1:1.1 +0.0
Test Execution Time 7s 13s +6s
Details
  |                     | main (8129e35) | #146 (d6b7e33) |  +/-  |
  |---------------------|----------------|----------------|-------|
+ | Coverage            |          48.5% |          48.7% | +0.2% |
  |   Files             |             52 |             52 |     0 |
  |   Lines             |           5244 |           5249 |    +5 |
+ |   Covered           |           2546 |           2561 |   +15 |
+ | Code to Test Ratio  |          1:1.1 |          1:1.1 |  +0.0 |
  |   Code              |          10564 |          10573 |    +9 |
+ |   Test              |          11955 |          12109 |  +154 |
- | Test Execution Time |             7s |            13s |   +6s |

Code coverage of files in pull request scope (73.5% → 80.7%)

Files Coverage +/- Status
mail/bulk.go 92.0% +16.2% modified
mail/mock_server.go 73.1% +1.0% affected

Reported by octocov

@linyows linyows merged commit 8b24287 into main Jan 13, 2026
7 checks passed
@linyows linyows deleted the fix-bulk-sent-count branch January 13, 2026 03:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant