0

I need to add custom form in my emails using thymeleaf templates in a spring boot application. The fonts are in a remote location with open urls.

I tried adding @font-face but the email styling has prefixed some html id like #someRandomDivId @font-face {...} And that is failing the css

The second way I tried was loading fonts via JavaScript but again my code was being commented out in the emails.

Does anybody know how to do this?

  • Worth having a look at this answer https://stackoverflow.com/a/38221574/2199826 – Naveen Sep 25 '19 at 07:08
  • The syntax is fine the problem is to add a custom font file that I have in .woff format stored in my server. I have tried giving th:src and th:href –  Sep 25 '19 at 09:30
  • Possible duplicate of [Does @font-face work in email templates?](https://stackoverflow.com/questions/28303631/does-font-face-work-in-email-templates) – holmis83 Sep 26 '19 at 07:40
  • Tried that too but didn't worked. I'm checking it on chrome and internet explorer. –  Sep 27 '19 at 02:47

1 Answers1

1

Adding font files to the emails is prohibited due to security concerns hence you won't be able to add custom fonts into your email templates. Even though it may seems to work on your localhost but once it's deployed you will see no effect on the emails. The only font file that works with email templates is the Google font cdn.

Beshambher Chaukhwan
  • 1,418
  • 2
  • 9
  • 13