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 the delivered_by_hanko flag is set to true. Then disable the email delivery and check that the email is not sent that the webhook gets called and that the delivered_by_hanko flag is set to false.
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
.