Skip to content

feat: allow mails to be intercepted using events #120

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Feb 26, 2025

Conversation

SamMousa
Copy link
Collaborator

Alternative for #117.

@mikk150 could you give this a go?
The idea behind this PR is to alternatively allow you to use the beforeSend or afterSend events for logging mails.
This should work by just setting a configuration in the module config; set mailMethod to before in the codeption config.

Let me know what you think; thanks for your contribution in #117 and bringing this feature to Codeception.

@mikk150
Copy link

mikk150 commented Feb 24, 2025

I'm going to try this tomorrow, today is national holiday where I live..

@SamMousa
Copy link
Collaborator Author

Todo: write tests for this configuration.

@mikk150
Copy link

mikk150 commented Feb 26, 2025

It works!

I think it is way simpler solution, and does not require mocking mailer at all which is a good thing. Only thing people have to keep in mind now is that using these new methods, emails could be actually sent out if you do not implement dummy mailer

I had to slightly change my mailer, but it was simply broken and I didn't know it

@SamMousa SamMousa merged commit ee68e5a into master Feb 26, 2025
2 checks passed
@SamMousa SamMousa deleted the mailer-proxy-alternative branch February 26, 2025 14:57
Copy link

🎉 This PR is included in version 2.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants