-
-
Notifications
You must be signed in to change notification settings - Fork 928
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
feat: send emails via http api endpoint instead of smtp #3048
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3048 +/- ##
==========================================
- Coverage 78.12% 77.11% -1.02%
==========================================
Files 324 312 -12
Lines 20762 19373 -1389
==========================================
- Hits 16221 14940 -1281
+ Misses 3333 3268 -65
+ Partials 1208 1165 -43
|
Nice work @barnarddt. I was looking for this feature for a long time. Hope it will be reviewed and released soon. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR! This is already going in a good direction. Here are some improvement ideas:
- Add tests for the new config options (right now the config won't work because it's not in the config JSON Schema)
- Add an e2e tests to test/e2e which ensures that this works end-to-end
- Make a few changes to the configuration layout
- Add documentation :)
@@ -0,0 +1,11 @@ | |||
function(ctx) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a good default value for the body payload. Maybe it makes sense to use it as the default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how we'd make it the default as the body of the template engine is a file URI not a absolute value?
For the end2end test what would be the preferred setup? Configure kratos to use the http email functionality with the url being a localhost port that the end2end test will listen on and ensure that that gets called when a admin call gets issued to do something that will trigger an email to be sent? |
Guys, any updates on this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This already looks fantastic. And sorry for the delays on our side.
As for the E2E tests, we already have some "mock" services that just provide a target for the webhooks to be tested with, here: https://github.com/ory/kratos/blob/master/test/e2e/mock. That service is started in test/e2e/modd.conf
Maybe you could set up some kind of echo server here, that makes all incoming messages available on an endpoint and assert that the expected messages end up in there?
Thanks @barnarddt - this is a great addition. Would you be up to address the requested changes? It'd be fantastic to get http email delivery support merged! Resolves #2825 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job! :)
Could you please add an end-to-end Testcafe / Cypress test (or some other type of integration test in Go) to prove that this does indeed work as intended? Thank you!
Sorry - I missed this comment :( Yes that could work! We now support PlayWright and there you can set up a mock server easily: https://playwright.dev/docs/test-webserver So probably the test would be this:
That should be it! |
@barnarddt thank you so much for your contribution! I did some clean-ups in #3341 to get this across the finish line:
|
Closing in favor of #3341. Again, big thanks to @barnarddt for the excellent work! |
This change adds a new delivery method to the courier called
mailer
. Similar to SMS functionality it posts a templated Data model to a API endpoint. This API can then send emails via a CRM or any other mechanism that it wants.Mailer
still uses the existing email data models so any new email added will automatically be sent to the API/CRM as well.Related issue(s)
Resolves #2825
Also see #1030 and #3008
Documentation PR ory/docs#1298
Checklist
introduces a new feature.
contributing code guidelines.
vulnerability. If this pull request addresses a security vulnerability, I
confirm that I got the approval (please contact
security@ory.sh) from the maintainers to push
the changes.
works.
Further Comments