adamant-refrigerator-93887
05/31/2024, 11:27 AMchilly-king-10285
05/31/2024, 11:27 AMchilly-king-10285
05/31/2024, 11:27 AMsmtp section sets up the SMTP server that Ory Kratos will use to send emails. The connection_uri is the connection string to your SMTP server, and from_name is the name that will appear as the sender of the emails. 2. The templates section defines the email templates that Ory Kratos will use when sending recovery emails. The recovery key has two subkeys: invalid and valid, each representing the email templates for invalid and valid recovery scenarios respectively. 3. Each of these subkeys (invalid and valid) has an email key, which further has a body key. The body key contains html and plaintext fields, which are the HTML and plaintext versions of the email body. These fields should contain Base64-encoded strings of your custom email templates. If you provide these configurations, Ory Kratos will use these custom templates instead of the default ones when sending recovery emails. If the system can't use the custom templates, it falls back to the built-in templates or to the template_override_path (if specified) [source](https://www.ory.sh/docs/kratos/self-hosted/mail-courier-templates#configuration). Please note that the Base64-encoded strings should be prefixed with base64:// [source](https://www.ory.sh/docs/kratos/emails-sms/custom-email-templates#using-custom-message-templates).adamant-refrigerator-93887
05/31/2024, 11:30 AMchilly-king-10285
05/31/2024, 11:30 AMchilly-king-10285
05/31/2024, 11:31 AMverification key in the templates section. Here's an example: ```yaml courier: smtp: connection_uri: smtps://test:test@mailslurper:1025/?skip_ssl_verify=true from_name: MyProject via Ory templates: recovery: invalid: email: body: html: base64://QWxsIHByYWlzZSBpcyBmb3IgQWxsYWgsIHBsZWFzZSB2ZXJpZnkgeW91ciBhY2NvdW50IGJ5IGNsaWNraW5nIHRoZSBmb2xsb3dpbmcgbGluazp7eyAuUmVjb3ZlcnlDb2RlIH19Cgo8YSBocmVmPSJ7eyAuUmVjb3ZlcnlDb2RlIH19Ij57eyAuUmVjb3ZlcnlDb2RlIH19PC9hPg== plaintext: base64://SGksIHBsZWFzZSByZWNvdmVyIGFjY2VzcyB0byB5b3VyIGFjY291bnQgYnkgZW50ZXJpbmcgdGhlIGZvbGxvd2luZyBjb2RlOnt7LlJlY292ZXJ5Q29kZX19Cg== valid: email: body: html: base64://QWxsIHByYWlzZSBpcyBmb3IgQWxsYWgsIHBsZWFzZSB2ZXJpZnkgeW91ciBhY2NvdW50IGJ5IGNsaWNraW5nIHRoZSBmb2xsb3dpbmcgbGluazp7eyAuUmVjb3ZlcnlDb2RlIH19Cgo8YSBocmVmPSJ7eyAuUmVjb3ZlcnlDb2RlIH19Ij57eyAuUmVjb3ZlcnlDb2RlIH19PC9hPg== plaintext: base64://QWxsIHByYWlzZSBpcyBmb3IgQWxsYWgsIHBsZWFzZSByZWNvdmVyIGFjY2VzcyB0byB5b3VyIGFjY291bnQgYnkgZW50ZXJpbmcgdGhlIGZvbGxvd2luZyBjb2RlOnt7LlJlY292ZXJ5Q29kZX19Cg== verification: invalid: email: body: html: <base64-encoded HTMLadamant-refrigerator-93887
05/31/2024, 11:37 AMchilly-king-10285
05/31/2024, 11:37 AMchilly-king-10285
05/31/2024, 11:37 AMemail.body.gotmpl file, you need to provide the new template in the configuration file (config.yml). Here's how you can do it: 1. Encode your new template to Base64. You can use the command echo "Your custom template" | base64 or an online tool like https://www.base64encode.org/. 2. Add your Base64-encoded custom template to the config.yml file under the courier key. Make sure to prefix the encoded template with base64://. Here's an example: yaml courier: template_override_path: /conf/courier-template templates: recovery: valid: email: body: html: <base64://ENCODED_HTML_TEMPLATE> plaintext: <base64://ENCODED_PLAINTEXT_TEMPLATE> Replace ENCODED_HTML_TEMPLATE and ENCODED_PLAINTEXT_TEMPLATE with your Base64-encoded templates. 3. Save the config.yml file and restart Ory Kratos. This will override the existing recovery template in the email.body.gotmpl file with your new template. If the system can't use the custom templates, it falls back to the built-in templates or to the template_override_path (if specified) [source](https://www.ory.sh/docs/kratos/self-hosted/mail-courier-templates#configuration).adamant-refrigerator-93887
05/31/2024, 11:50 AMchilly-king-10285
05/31/2024, 11:50 AMchilly-king-10285
05/31/2024, 11:50 AMtemplate_override_path you provided seems to be pointing directly to a specific template file (email.body.gotmpl). However, the template_override_path should point to the root directory where all your custom templates are located, not a specific file. Here's how you can correct it: 1. Move your custom templates to a specific directory. For example, you can create a directory named custom_templates and place all your custom templates there. 2. Set the template_override_path to point to this directory. Here's an example: yaml courier: smtp: connection_uri: <smtps://test:test@mailslurper:1025/?skip_ssl_verify=true> from_name: MyProject via Ory template_override_path: C:\Users\DLL\Documents\GitHub\kratos\courier\template\custom_templates 3. Save the config.yml file and restart Ory Kratos. Now, Ory Kratos will look for the custom templates in the custom_templates directory. If it can't find a custom template for a specific email, it will fall back to the built-in templates [source](https://www.ory.sh/docs/kratos/self-hosted/mail-courier-templates#configuration). Also, ensure that your custom templates are correctly structured. For example, the recovery email templates should be located at <template-root>/recovery/valid and <template-root>/recovery/invalid [source](https://www.ory.sh/docs/kratos/self-hosted/mail-courier-templates#configuration).adamant-refrigerator-93887
05/31/2024, 11:53 AMchilly-king-10285
05/31/2024, 11:53 AMchilly-king-10285
05/31/2024, 11:53 AMtemplate_override_path you provided seems to be pointing to the built-in templates directory. If you want to use custom templates, you should create a separate directory for them and point template_override_path to that directory. Here's how you can do it: 1. Create a new directory for your custom templates. For example, you can create a directory named custom_templates in the template directory. 2. Place your custom templates in this new directory. Make sure to follow the correct structure. For example, the recovery email templates should be located at <template-root>/recovery/valid and <template-root>/recovery/invalid. 3. Set the template_override_path to point to this new directory. Here's an example: yaml courier: template_override_path: C:\Users\DLL\Documents\GitHub\kratos\courier\template\custom_templates 4. Save the config.yml file and restart Ory Kratos. Now, Ory Kratos will look for the custom templates in the custom_templates directory. If it can't find a custom template for a specific email, it will fall back to the built-in templates [source](https://www.ory.sh/docs/kratos/self-hosted/mail-courier-templates#configuration).