Skip to content

Add bulk email sending functionality and error handling issue #275#285

Merged
sabuhish merged 5 commits intosabuhish:masterfrom
pipinstalled:feature/MultipleEmails
Dec 8, 2025
Merged

Add bulk email sending functionality and error handling issue #275#285
sabuhish merged 5 commits intosabuhish:masterfrom
pipinstalled:feature/MultipleEmails

Conversation

@pipinstalled
Copy link
Contributor

@pipinstalled pipinstalled commented Nov 9, 2025

Base on request on issue no #275

  • Introduced send_messages() method to allow sending multiple emails in a single SMTP session, improving efficiency and reducing overhead.
  • Added EmptyMessagesList exception to handle cases where the messages list is empty.
  • Updated documentation to include examples of bulk email sending.
  • Enhanced tests to cover various scenarios including empty lists and invalid message types.

- Introduced `send_messages()` method to allow sending multiple emails in a single SMTP session, improving efficiency and reducing overhead.
- Added `EmptyMessagesList` exception to handle cases where the messages list is empty.
- Updated documentation to include examples of bulk email sending.
- Enhanced tests to cover various scenarios including empty lists and invalid message types.
- Adjusted the import order in `fastmail.py` for better readability.
- Updated the test in `test_connection.py` to decode email payloads before assertions, ensuring accurate content verification for templated messages.
@sabuhish
Copy link
Owner

Hi @pipinstalled, thanks for the work.
In my opinion, we are repeating ourselves by having the send_messages function.
This function duplicates the logic of send_message, which goes against the DRY principle.
We could use the same function but extend it to accept either a single MessageSchema or a list of them.
This way, it would be simpler for users as well.

… multiple messages in one call. Updated documentation and examples accordingly, and modified tests to reflect the new method. Enhanced error handling for empty message lists and invalid message types.
@pipinstalled
Copy link
Contributor Author

pipinstalled commented Nov 11, 2025

Hi @pipinstalled, thanks for the work. In my opinion, we are repeating ourselves by having the send_messages function. This function duplicates the logic of send_message, which goes against the DRY principle. We could use the same function but extend it to accept either a single MessageSchema or a list of them. This way, it would be simpler for users as well.

Thanks for your comment I made some changes, please check it and let me know if it needs any change. @sabuhish

@pipinstalled
Copy link
Contributor Author

@sabuhish Have you any idea when will this PR merge?

@sabuhish
Copy link
Owner

sabuhish commented Dec 8, 2025

Thanks for the updated code. I think we are safe to merge this.

@sabuhish sabuhish merged commit 13b7149 into sabuhish:master Dec 8, 2025
2 checks passed
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.

2 participants