Skip to content

Create envelope to validate mail#27

Merged
Bhacaz merged 2 commits intomainfrom
smtp_envelope
Aug 27, 2025
Merged

Create envelope to validate mail#27
Bhacaz merged 2 commits intomainfrom
smtp_envelope

Conversation

@Bhacaz
Copy link
Collaborator

@Bhacaz Bhacaz commented Aug 26, 2025

This pull request improves the reliability of the RailsCacheDeliveryMethod by adding envelope validation to ensure that emails have valid sender and recipient addresses before delivery. It also enhances the test suite to cover these validation scenarios. Fix #24

Envelope validation improvements:

  • In lib/gravity_mailbox/rails_cache_delivery_method.rb, the deliver! method now creates a Mail::SmtpEnvelope for the email, which validates the presence of sender and recipient addresses before caching the mail.

Test coverage enhancements:

  • In spec/gravity_mailbox/rails_cache_delivery_method_spec.rb, the test mail setup now includes explicit from and to addresses to ensure valid envelope data for standard cases.
  • Added new test contexts to verify that an error is raised if the mail has no sender, no recipients, or an invalid sender address, ensuring that envelope validation is properly enforced.

@Bhacaz Bhacaz merged commit 245d6cf into main Aug 27, 2025
7 checks passed
@Bhacaz Bhacaz deleted the smtp_envelope branch August 27, 2025 13:05
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.

The delivery method doesn't raise an error when no from or to.

2 participants