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

How to add custom template #428

Closed
myoussef89 opened this issue Mar 31, 2020 · 13 comments
Closed

How to add custom template #428

myoussef89 opened this issue Mar 31, 2020 · 13 comments

Comments

@myoussef89
Copy link

my current config but not working

email:
app_name: Matrix
client_base_url: https://riot.**************
enable_notifs: true
notif_for_new_users: true
notif_from: Matrix <**************>
require_transport_security: false
smtp_host: matrix-mailer
smtp_port: 8025
template_dir: /data/res/templates
#add_threepid_template_html: add_threepid.html

@spantaleev
Copy link
Owner

What do you mean "it's not working"?

Perhaps check the Synapse logs (journalctl -fu matrix-synapse)?

@myoussef89
Copy link
Author

I mean it sends the default template that I also don't know where it exists

You have asked us to register this email with a new Matrix account. If this was you, please click the link below to confirm your email address:

Verify Your Email Address
If this was not you, you can safely disregard this email.

Thank you.

and with this configuration, it starts with no errors and also keeps sending the default mail template

@spantaleev
Copy link
Owner

Is this the configuration that you see in /matrix/synapse/config/homeserver.yaml or is this simply what you specify in the matrix_synapse_configuration_extension_yaml variable?

I'm not sure why Synapse wouldn't be loading your custom templates.

@myoussef89
Copy link
Author

that is what I can see right now because I had edited that part by adding

template_dir: /data/res/templates

@spantaleev
Copy link
Owner

I hope you've put it in the correct place (that is, that you indentation is correct).

If the templates are still not being loaded, you may try reporting the issue at the Synapse project.

@myoussef89
Copy link
Author

I think it's correct as I saw it in another issue
matrix-org/synapse#2331 (comment)

but what I am asking about, is there any variable to activate that factuality in the ansible build ?

@spantaleev
Copy link
Owner

Yes, as I mentioned above, you can use something like this:

matrix_synapse_configuration_extension_yaml: |
  email:
    template_dir: /data/res/templates

and then put your files in /matrix/synapse/config/res on the server. The /matrix/synapse/config directory gets mounted as /data in the container.

Also note: file ownership should be matrix:matrix for the /matrix/synapse/config/res directory and files inside it or Synapse may fail to load them.

@spantaleev
Copy link
Owner

Did you get this solved?

@spantaleev
Copy link
Owner

spantaleev commented Apr 3, 2020

I think things may change about this if you're using the default setup (which installs ma1sd as an identity server).

Until now, due to a regression on our side, Synapse was sending these email-ownership confirmation messages.

Normally, this should be the identity server's job. I've fixed it today.

Not that it solves your problem of "overriding default email templates in Synapse", but you may observe that it's no longer Synapse that will be sending these email-validation messages.

@myoussef89
Copy link
Author

Thanks , I ll check on it and feedback

Do I have to set any vars ?

@spantaleev
Copy link
Owner

There's a way to override ma1sd email templates. See roles/matrix-ma1sd/defaults/main.yml for more information about it.

@myoussef89
Copy link
Author

myoussef89 commented Apr 3, 2020

if I set this value matrix_ma1sd_threepid_medium_email_custom_templates_enabled with True
do i have to set also those
matrix_ma1sd_threepid_medium_email_custom_invite_template: "" matrix_ma1sd_threepid_medium_email_custom_session_validation_template: "" matrix_ma1sd_threepid_medium_email_custom_unbind_fraudulent_template: "" matrix_ma1sd_threepid_medium_email_custom_matrixid_template: ""
or it will copy from ma1sd/src/main/resources/threepids/email then i replace them on data ?

@spantaleev
Copy link
Owner

If you you want to override some template, you need to define a _template variable, yes.

Refer to src/main/resources/... for the current defaults and go from there.
You need to copy paste those contents into whichever _template variable you'd like to override.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants