Fix bulk mail delivery to return actual message count#146
Merged
Conversation
…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>
This comment has been minimized.
This comment has been minimized.
Code Metrics Report
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%)
Reported by octocov |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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), theSentfield inDeliveryResultwould incorrectly report1(the session count) instead of5(the actual messages sent).Changes
Bulk.Send()to return(int, error)to report the number of messages sentDeliverWithResult()to aggregate message counts from all sessionsSessionsfield toDeliveryResultstruct to track session count separatelybulk_test.gocovering various scenariosTest Results
All tests pass:
🤖 Generated with Claude Code