Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Plugins

Using a custom email template with Email Plugin

first-time

Started by Robert Nelson Jr 8 years ago · 2 replies · 788 views
8 years ago

Hi there!
I am still in the process of learning all the good things that come with Grav.
Currently I'd like to replace my /email/templates/base.html.twig file with a custom designed email template.
I have tried adding a copy to my theme under /templates/email/base.html.twig and also tried /templates/partials/email/base.html.twig
I've had no luck with either.
This is likely under my nose somewhere, but I haven't had any luck with overriding the default base.html.twig template. I also don't see an option for defining a specific template in the form.md file.
Thank you for your help!

8 years ago

@rnjr It seems to be working OK in my installation:

  • Copied folder '/user/plugins/email/templates/email' to folder '/user/themes/mytheme/templates/'
  • Changed style in '/user/themes/mytheme/templates/email/base.html.twig' to:
    CSS
    h1, h2, h3 {
      ...
      color: red;
    }
    
  • Send email using $ bin/plugin email test-email -t <my email address>
  • Received an email with a header in red...

Which theme are you using?

last edited 08/27/18 by pamtbaau
2 years ago

True, the message is six years old but, seen in a similar situation, I have realised that there is no point in overwriting the email template if in the form header you don't indicate that it processes the email in the appropriate mode, either text mode or html mode.

TWIG
form:
        -
            email:
                body: '{% include ''forms/data.txt.twig'' %}'

Maybe @rnjr or someone else will find this detail useful.

Greetings!

Suggested topics

Topic Participants Replies Views Activity
Plugins · by Rene, 1 week ago
2 42 1 week ago
Plugins · by Xavier, 4 weeks ago
2 53 4 weeks ago
Plugins · by Luka Prinčič, 7 years ago
3 1179 1 month ago
Plugins · by Sebastian van de Meer, 1 month ago
1 47 1 month ago
Plugins · by PIERROT Alain, 2 months ago
3 71 2 months ago