1

Good evening everyone,

I am trying to make an html email using a CRM that has a total price which i get from {total_price} and a deposit 50% of the total price. As there is no {deposit} in the CRM i am using , i though i would make a simple calculation

<!DOCTYPE html>

<html>
<p id="deposit"></p>
<script>

var x={total_price};
var y=0.5;
var  z=x*y;

document.getElementById("deposit").innerHTML = "Deposit : " + z + "€";
</script>

But my CRM doesn't seem to be able to handle JS, is there any other way to have the same result?

  • It's probably not the CRM system that doesn't allow javascript but the email clients. In an email a lot of things are prohibited because otherwise the email sender could do malicious things with javascript, for example if javascript was allowed in mails, the script could close the current mail and open another and send it to a server. – Stan Mar 19 '22 at 11:10
  • Take a look at this maybe; I am not that deep into webprogramming, but it might be relevant: https://www.tutorialspoint.com/How-to-include-the-result-of-a-calculation-in-HTML5 Sry if I am wrong. – Natan Mar 19 '22 at 11:11
  • 1
    The solution pointed by @Natan actually uses JavaScript on the `oninput` event of the form. – vanderdill Mar 19 '22 at 11:15
  • 1
    Could you share the name of the CRM you are using? There might be template functions that can process the mail while it's generated – Stan Mar 19 '22 at 11:30

1 Answers1

0

Unfortunately, no way. HTML is a markup language, it has no processor powers, at all. That's why javascript came into the browsers. And modern email clients doesn't support javascript.

Your CRM could have some custom proprietary variables or customization for HTML, that should be processed before sending the email. It's a nice feature to have on a CRM.

There is more here about JavaScript on email.

vanderdill
  • 162
  • 2
  • 14