<@U04UQ68083H> suggest how to use these file i.e e...
# ory-copilot
a
@chilly-king-10285 suggest how to use these file i.e email_html_template_base_64.txt contain QWxsIHByYWlzZSBpcyBmb3IgQWxsYWgsIHBsZWFzZSByZWNvdmVyIGFjY2VzcyB0byB5b3VyIGFjY291bnQgYnkgZW50ZXJpbmcgdGhlIGZvbGxvd2luZyBjb2RlOnt7LlJlY292ZXJ5Q29kZX19Cgo8YSBocmVmPSJ7eyAuUmVjb3ZlcnlDb2RlIH19Ij57eyAuUmVjb3ZlcnlDb2RlIH19PC9hPg==, email_plaintext_template_base64.txt contain base64://SGksIHBsZWFzZSByZWNvdmVyIGFjY2VzcyB0byB5b3VyIGFjY291bnQgYnkgZW50ZXJpbmcgdGhlIGZvbGxvd2luZyBjb2RlOnt7LlJlY292ZXJ5Q29kZX19Cg==, email_subject_template_base64.txt conatain UmVjb3ZlciBhY2Nlc3MgdG8geW91ciBUQ0YgYWNjb3VudA== in my kratos.yml courier configuration i.e 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://QWxsIHByYWlzZSBpcyBmb3IgQWxsYWgsIHBsZWFzZSByZWNvdmVyIGFjY2VzcyB0byB5b3VyIGFjY291bnQgYnkgZW50ZXJpbmcgdGhlIGZvbGxvd2luZyBjb2RlOnt7LlJlY292ZXJ5Q29kZX19Cgo8YSBocmVmPSJ7eyAuUmVjb3ZlcnlDb2RlIH19Ij57eyAuUmVjb3ZlcnlDb2RlIH19PC9hPg== plaintext: base64://SGksIHBsZWFzZSByZWNvdmVyIGFjY2VzcyB0byB5b3VyIGFjY291bnQgYnkgZW50ZXJpbmcgdGhlIGZvbGxvd2luZyBjb2RlOnt7LlJlY292ZXJ5Q29kZX19Cg==
c
A message from kapa.ai
To use your custom email templates in your
kratos.yml
configuration, you need to replace the existing base64 encoded templates with your own. Here's how you can do it: 1. Replace the existing base64 encoded templates in the
kratos.yml
file with your own. Your
kratos.yml
file should look something like this:
Copy code
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://QWxsIHByYWlzZSBpcyBmb3IgQWxsYWgsIHBsZWFzZSByZWNvdmVyIGFjY2VzcyB0byB5b3VyIGFjY291bnQgYnkgZW50ZXJpbmcgdGhlIGZvbGxvd2luZyBjb2RlOnt7LlJlY292ZXJ5Q29kZX19Cgo8YSBocmVmPSJ7eyAuUmVjb3ZlcnlDb2RlIH19Ij57eyAuUmVjb3ZlcnlDb2RlIH19PC9hPg>=="             plaintext: "<base64://SGksIHBsZWFzZSByZWNvdmVyIGFjY2VzcyB0byB5b3VyIGFjY291bnQgYnkgZW50ZXJpbmcgdGhlIGZvbGxvd2luZyBjb2RlOnt7LlJlY292ZXJ5Q29kZX19Cg>=="
2. Save the changes to the
kratos.yml
file. Please note that in the Ory Network, you can use only Base64-encoded templates.
http://
or
file://
URIs are not supported. If you provide custom templates using unsupported methods, the system uses the default templates. For more information, you can refer to the [Ory documentation](https://www.ory.sh/docs/kratos/emails-sms/custom-email-templates#using-custom-message-templates).
a
@chilly-king-10285 i want to use the files containing base 64 contents for html,plaintext andsubject which i provided and not the base 64 contents directly
c
A message from kapa.ai
If you want to use the files containing the base64 contents for HTML, plaintext, and subject, you can do so by reading the contents of these files and using them in your
kratos.yml
configuration. However, this process is not directly supported by Ory Kratos and would require additional scripting or programming to read the file contents and insert them into the configuration. Here's a general idea of how you could do it: 1. Write a script or program in your preferred language that reads the contents of your base64 files. 2. In this script, format these contents as needed for the
kratos.yml
configuration. 3. Use this script to generate or update your
kratos.yml
configuration with the base64 contents from your files. Please note that this is a general approach and the specifics will depend on your programming language and environment. For more information on how to use custom email templates in Ory Kratos, you can refer to the [Ory documentation](https://www.ory.sh/docs/kratos/emails-sms/custom-email-templates#using-custom-message-templates).
a
@chilly-king-10285 is doing so correct? email: body: html: file:/courier/template/courier/custom/templates/recovery_code/valid/email_html_template_base64.txt plaintext: file:/courier/template/courier/custom/templates/recovery_code/valid/email_plaintext_template_base64.txt
c
A message from kapa.ai
No, the approach you mentioned is not correct. In Ory Kratos, you cannot directly reference a file containing base64 encoded templates in the configuration file. The
file://
URI scheme is not supported for base64 encoded templates. The correct way is to include the base64 encoded string directly in the configuration file under the
html
and
plaintext
keys. Here's an example:
Copy code
yaml courier:   smtp:     from_name: MyProject via Ory   templates:     recovery:       valid:         email:           body:             html: "<base64://ENCODED_HTML_TEMPLATE>"             plaintext: "<base64://ENCODED_PLAINTEXT_TEMPLATE>"
In this example,
ENCODED_HTML_TEMPLATE
and
ENCODED_PLAINTEXT_TEMPLATE
should be replaced with your base64 encoded templates. For more information, you can refer to the [Ory documentation](https://www.ory.sh/docs/kratos/emails-sms/custom-email-templates#using-custom-message-templates).