Skip to content

Conversation

@pipinstalled
Copy link

@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
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants