Add a custom attribute to <a href> in email template

Version: v5.11.66

Environment: Docker

Checklist

  • Can you replicate the issue on our v5 demo site https://demo.invoiceninja.com or Invoice Ninja? N/A
  • Have you searched existing issues? Yes
  • Have you inspected the logs in storage/logs/laravel.log for any errors? N/A

Problem Description

I’m using SES for sending emails, and am trying to disable link tracking, which requires adding a custom ses:no-track attribute to the links, like so:
<a ses:no-track href="aws.amazon.com">Amazon Web Services</a>

Steps To Reproduce

  1. Navigate to Settings → Templates & Reminders
  2. Modify the email template to contain a URL link
  3. Click on ... and then <> to view the Source Code of the template
  4. Add ses:no-track to <a tag
  5. Click Save
  6. Open Source Code again
  7. Observe that the custom attribute wasn’t saved

Expected Behavior

Custom attribute of <a is saved

Additional context

While I can disable tracking feature altogether in AWS Console, I’d still like to track email opens, just not the clicks (because I don’t want to have garbled links that might not open for the customers, if they’re using an ad-blocker). Adding ses:no-track attr seems to be the only way currently to achieve this selective tracking.

More broadly, is it possible to customize HTML templates in other situations like this, or does the template editor always “sanitize” them with only the list of supported attributes?

Thank you!

Hi,

If you’re using the web app can you check if you see a difference with the desktop app, it will help determine the source of the problem.

@hillel Very interesting, thanks! When I update the template with ses:no-track in macOS app, the attribute is indeed saved and displayed successfully. I then click Send Email for an invoice (for myself), and receive an email that indeed contains only the original link without being converted by SES into their tracking link.

However, when I then go to the web app (without re-saving the template), both in the Settings the template is displayed without the attribute, and when I click Send Email in the web app, it sends the email with the tracking still enabled.

So, it looks like the issue might be with how the web app view renders the template - it seems to sanitize that extra attr away.

I suggest creating an issue here to follow up:

1 Like

Filed, thanks again! Web app not rendering custom <a href> attributes · Issue #2487 · invoiceninja/ui · GitHub

1 Like