alexzaganelli / strapi-plugin-email-designer

Design your own email templates w/ visual composer directly inside the Strapi admin panel and send composed emails programmatically from your controllers / services.
MIT License
328 stars 52 forks source link

Variables looked for in uppercase instead of specified format: SENDERNAME is not defined instead of senderName #124

Closed alexphiev closed 1 month ago

alexphiev commented 1 year ago

Bug report

Describe the bug

I need to send my email template variables from the code with upper case even though the template mentions {{= variableName }} in this format.

Steps to reproduce the behavior

  1. Create a template with the{{= senderName }} variable in any text or in the subject
  2. Save and use it in the code with the variable sent as senderName with the method: strapi.plugins["email-designer"].services.email.sendTemplatedEmail()

Additional context

It seems to be happening only in PROD environment but not 100% sure.

github-actions[bot] commented 1 year ago

Thank you!! This is your first issue on this repo

dzpincus commented 1 year ago

I'm also experiencing this issue. Any resolution?

creazy231 commented 1 year ago

Could you explain what do you mean by having to send variables in uppercase by giving us an example on how it works and on how it not works?

dalton5 commented 1 year ago

Yes I have the same issue. I investigated. It's due to htmltotext method. It uses the lib html to text and for H1 or H2 it puts by default uppercase. You need to remove this otherwise when we call a variable lowercase in a title it can't find it because the text version transforms in uppercase.

See below the description from htmltotext:
uppercase | true | heading | By default, headings (<h1>, <h2>, etc) are uppercased.Set this to false to leave headings as they are.

Please fix it because I have the same issue. Thanks,

creazy231 commented 1 year ago

Since #128 was merged, could you try to clone the main branch of this repository into your plugins folder and configure the plugin to resolve to this folder instead of using the one you've installed already? Don't forget to run yarn / npm install inside the cloned folder.

Does this solve the issue?