I would like to know if I can add JavaScript on my email that would communicate with my api to know if the email was opened by the user
CodePudding user response:
The short answer is: you can not.
Every e-mail client will block any JS (that is all <script>
s but also onclick=
, onload=
attributes etc.) in e-mails for safety and privacy reasons.
The only option available is to use an image like:
<img src="https://example.com/email-opened.php?id=453254">
...but some e-mail clients will block remote images by default as well.