Open sevenseacat opened 1 day ago
So, we can do this, but to do it right we likely need to add a couple swoosh specific helpers, i.e Igniter.Libs.Swoosh
. Eventually we'd like these to be extracted out to their respective libraries.
@sevenseacat I imagine you'd like this in for the auth chapter in the book. It also makes sense from our live stream today with Peter who expected to go to the dev mailbox and see the email right away. We ought to be able to set it up without too much hassle.
I'll try and do this tomorrow, but it might have to wait til next week.
Yes I did the exact same thing as Peter; when I saw the output in my logs I expected to also see it in an email in the dev mailbox.
Maybe it doesn't have to go that far, but having the Emails module set up ready to plug a mailer straight into would be a good compromise.
Igniters such as
ash_authentication.add_strategy password
generate sender modules that look like this:It took me a bit to realize that to actually send the email, I would have to create the
Tunez.Accounts.Emails
module, and define that function with the right copy and then create and send an email.My thinking was that the igniter could generate something more fully-featured, like the example in the tutorial - https://hexdocs.pm/ash_authentication/confirmation.html#confirming-newly-registered-users, eg.
send_password_reset_email
(and adeliver
function if one doesn't exist)If adding the
deliver
function, it can print out the content and perhaps have the other content from the docs included but commented out