Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Add a config option to disable email delivery by hanko. Currently there is no way to style the emails hanko is sending. With this option a user can send and style the emails themself.
If email delivery is disabled you do not need to provide smtp settings. To send an email yourself you need to add a webhook which is subscribed to the
email.create
event.Implementation
A new webhook event is introduced (
email.create
). This will always be triggered when an email was sent or when it should be sent, depending if email delivery is enabled or disabled. This webhook event contains all data that is necessary to send your own email (e.g. subject, body, passcode, ttl, toAddress). This webhook event also contains a flag which indicates if the email was sent by hanko or not.Tests
To test this create a new webhook with the
email.create
event. Then enable the email delivery (it is by default) and check if the email is still sent and that the webhook gets called and thedelivered_by_hanko
flag is set totrue
. Then disable the email delivery and check that the email is not sent that the webhook gets called and that thedelivered_by_hanko
flag is set tofalse
.