Skip to content
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

Email rendering & delivery via API / HTTP #2825

Closed
5 of 6 tasks
joshbalfour opened this issue Oct 19, 2022 · 3 comments · Fixed by #3341
Closed
5 of 6 tasks

Email rendering & delivery via API / HTTP #2825

joshbalfour opened this issue Oct 19, 2022 · 3 comments · Fixed by #3341
Assignees
Labels
feat New feature or request.

Comments

@joshbalfour
Copy link

joshbalfour commented Oct 19, 2022

Preflight checklist

Describe your problem

Hiya,
First off: huge fan of what the team has accomplished here, this is by no means a criticism just a feature idea 😄

I've been setting up email templates (did SMS first) and was thinking:
Would it be more in the project ethos of "API-only - without templating or theming headaches" to have email/SMS be processed via a user-built API rather than rendered via the templating system and sent via SMTP?
I got to this by running through a requirement that's come up of being able to theme the emails depending on who it's sent to (we have centralised auth but will theme the login screens based on the product you're logging in to).

Describe your ideal solution

Much like the way you currently configure SMS delivery via the config, you could configure an endpoint that would be sent the message type (e.g. recovery.valid), the context variables (e.g. .RecoveryURL) and who to deliver it to.

Workarounds or alternatives

It's incredibly cursed but I could:

  1. Change the templates to:
    body - render a JSON string with the context variables
    subject - the message type

  2. Build an SMTP server that would take the to/subject/body from the email, parse the context from the body and message type from the subject

  3. Render the new email body and subject based on the message type, context, and who it's going to, then send it on its way

If this feature was built then I could cut out the first two steps here so it'd be a lot less cursed.

Version

v0.10.1

Additional Context

No response

@joshbalfour joshbalfour added the feat New feature or request. label Oct 19, 2022
@aeneasr
Copy link
Member

aeneasr commented Oct 20, 2022

Josh, I think this is a great idea! We will probably keep email rendering in for ease of use, but it could make sense to have an API-based courier. This has been requested also in issue #1030

I think it should be relatively straight forward, we can probably re-use the SMS courier as that already is based on a REST API.

@hugotiburtino
Copy link

hugotiburtino commented Oct 28, 2022

joshbalfour, you read my thoughts! 😄

For our case I would also need more info from the UI that made the request in the first place (like the origin or in general all headers). If it were by default or we could customize it, it would be great.

By the way, if we could also customize to send the rendering back to kratos courier or just not (that means the API would send the email by itself) it would be even better.

@kmherrmann kmherrmann mentioned this issue May 5, 2023
6 tasks
@kmherrmann kmherrmann changed the title Email rendering & delivery via API Email rendering & delivery via API / HTTP May 5, 2023
@kmherrmann
Copy link
Contributor

As this is being discussed in a couple of places, let's make this one the canonical one.

Also see #1030

PR: #3048

@jonas-jonas jonas-jonas self-assigned this Jun 14, 2023
@hperl hperl mentioned this issue Jun 22, 2023
7 tasks
@hperl hperl self-assigned this Jun 23, 2023
@jonas-jonas jonas-jonas removed their assignment Jun 28, 2023
aeneasr pushed a commit that referenced this issue Jul 5, 2023
…smtp (#1030) (#3341)


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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat New feature or request.
Projects
None yet
6 participants