email styling

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • xlyz
    Junior Member
    • Mar 2024
    • 9

    #1

    email styling

    Hi

    I would like to set a base template with styling and elements that shall be inherited by all the email templates when email is in html. Is it possible? How?
    Last edited by xlyz; 09-26-2025, 08:32 PM.
  • shalmaxb
    Senior Member
    • Mar 2015
    • 1754

    #2
    Theoretically it could be made by some steps you would have to take. But I do not know the consequences.
    The EmailTemplate entity is not customizable by default. This for sure has a reason.
    You could experiment in the following way:
    Set customizable for the entity EmailTemplates to true, delete cache in Admin
    Write a formula
    ifThen(
    isHtml == true,
    body = string\concatenate('set here the whole code for your template')
    );

    But as said, I do not know all the consquences and regarding the entity EmailTemplates it would not be update safe, as that entity is not custom.

    Comment

    • xlyz
      Junior Member
      • Mar 2024
      • 9

      #3
      Hi

      Originally posted by shalmaxb
      Set customizable for the entity EmailTemplates to true, delete cache in Admin
      How? I can not find the option, and I can not find where to write the formula. Do I need to do it in code? Can you give me a hint?

      Comment

      • shalmaxb
        Senior Member
        • Mar 2015
        • 1754

        #4
        Seems, you are not well familiar with espoCRM.
        1. The entity EmailTemplate is by default not customizable. You can see this in the entity manager (Admin area), you cannot open this entity by default. To set it customizable, find the file app->EspoCRM->metadata->scopes (scopes is the entity confguration) -> EmailTemplates and there set "customizable": true.
        2. Rebuild in Admin interface, empty cache, refresh browser. Now in the entity manager EmailTemplates appears customizable. There you can set fields, relationships and also formula.
        The formula provides an easier form to make calculations and other stuff, refer to the documentation. It is something to learn, but mostly very easy.
        3. Create a formula like I provided above. This should cause, that the formula part of body will be set, whenever you mark "is HTML".

        As I said, this modification is placed in the app folder, which is the folder for all mandatory and default entities. I do not know, if EmailTemplate would be possible as custom entity and also I cannot recommend this way, because it is not update safe, nor do I know if it may have undesired consequencies in other places. It is an experimantal way, which perhaps could be enhanced to an update safe possibility. Just test it.

        Comment

        • xlyz
          Junior Member
          • Mar 2024
          • 9

          #5
          thanks.

          eventually we opted for an external solution. we created an email filter relay that alters the email after espocrm has sent them and inject styling and a footer.

          Comment

          Working...