<@U04UQ68083H> How can we create custom email temp...
# ory-copilot
p
@chilly-king-10285 How can we create custom email templates for verification and account recovery?
c
A message from kapa.ai
To create custom email templates for verification and account recovery, follow these steps: 1. For Ory Console: - Go to CustomizeEmail Configuration on the [Ory Console](https://console.ory.sh/projects/current/email-configuration) and select the email template you want to customize from the Email Templates section at the bottom of the page. 2. For Ory CLI: - List all your projects and get the Ory Identities config file:
Copy code
## List all available projects      ory list projects            ## Get config      ory get identity-config <project-id> --format yaml > identity-config.yaml
- Add your Base64-encoded custom message templates to the config:
Copy code
courier:       smtp:        from_name: MyProject via Ory       templates:        recovery:         invalid:          email:           body: { "html": "<base64://ENCODED_HTML_TEMPLATE>", "plaintext": "<base64://ENCODED_PLAINTEXT_TEMPLATE>" }         valid:          email:           body: {}        verification:         invalid:          email:           body: {}         valid:          email:           body: {}
- Upload the edited config:
Copy code
ory update identity-config <project-id> --file updated_config.yaml
In self-hosted Ory Kratos instances, you can add custom templates from
http://
,
file://
, and
base64://
URIs. You can find more information on how to configure custom email templates in self-hosted Ory Kratos instances [here](https://www.ory.sh/docs/kratos/self-hosted/mail-courier-templates#configuration). For internationalized templates, you can use in-line template definitions or separate template files. You can find examples and more information on creating translated templates [here](https://www.ory.sh/docs/kratos/emails-sms/custom-email-templates#translated-templates-i18n) and [here](https://www.ory.sh/docs/kratos/self-hosted/mail-courier-templates#translated-templates). Remember that the
Identity
object is available inside the templates, allowing you to customize the content based on the recipient's identity. More information on customizing template content for specific users can be found [here](https://www.ory.sh/docs/kratos/emails-sms/custom-email-templates#customizing-template-content-for-specific-users).
p
The above solution is not enough to achieve the task, please provide another solution?
@chilly-king-10285 The above solution is not enough to achieve the task, please provide another solution?
c
A message from kapa.ai
Hmm, I don't know enough to give you a confident answer yet. However, you can refer to the Ory documentation for more information on custom email templates: - [Custom Email Templates](https://www.ory.sh/docs/kratos/emails-sms/custom-email-templates) - [Email Templates in Self-hosted Ory Kratos](https://www.ory.sh/docs/kratos/self-hosted/mail-courier-templates)
p
@chilly-king-10285 how to add verification url in templates ?
c
A message from kapa.ai
To add a verification URL in your custom email templates, you can use the
VerificationURL
variable. Here's an example of how to include the verification URL in an HTML template:
Copy code
html <p>Click the following link to verify your email address:</p> <p><a href="{{ .VerificationURL }}">Verify Email</a></p>
And for a plaintext template:
Copy code
Click the following link to verify your email address: {{ .VerificationURL }}
The
{{ .VerificationURL }}
placeholder will be replaced with the actual verification URL when the email is sent. For more information on custom email templates, refer to the following documentation: - [Custom Email Templates](https://www.ory.sh/docs/kratos/emails-sms/custom-email-templates) - [Email Templates in Self-hosted Ory Kratos](https://www.ory.sh/docs/kratos/self-hosted/mail-courier-templates)
p
@chilly-king-10285 Getting this error [5:57 PM] Jaimal Deswal {"error":{"code":500,"status":"Internal Server Error","message":"template: base64://SGl7e1BlcnNvbi50cmFpdHMubmFtZS5maXJzdH19LCBwbGVhc2UgdmVyaWZ5IHlvdXIgYWNjb3VudCBieSBjbGlja2luZyB0aGUgZm9sbG93aW5nIGxpbms6IA==1 function \"Person\" not defined"}}
c
A message from kapa.ai
Sorry @purple-intern-72952, I seem to be having a bit of trouble. Don't worry though, I've pinged my support folks and they will try to fix me up! 🧑‍💻 Perhaps try again in 5mins?