1

In my organization many of the employees believe the user activation email sent out by Craft is spam. How do I change the email text and possibly add an image, like our company logo, to the email?

1 Answer 1

4

Under Settings > Email there is a field called "HTML Email Template" which you can use to point to a single template that handles all of the system emails. It's not very obvious from the Craft UI, but you can use that single template as a routing mechanism for including per-email templates using the variable emailKey which is available in the template. Your routing template could look like this:

{# Craft has four predefined email keys:

    account_activation
    verify_new_email
    forgot_password
    test_email

... route to them here, or fallback to default
#}

{% include [
    '_emails/' ~ emailKey ?? null,
    '_emails/default'
] %}

You'd then have another template called account_activation.twig where you can go wild with whatever modifications you like. Each email also has a link variable available in the template to output the link to whatever it is.

3
  • This works great for HTML emails, but I noticed the plain text component of the email is still using the system messaging (easy to spot if using MailHog in development). Any idea how to target updating the text version also?
    – Nate Beaty
    Apr 28, 2022 at 18:11
  • great question, let me know here if you find out a way! Apr 29, 2022 at 16:19
  • 1
    For now I just ended up editing the text message in Utilities > System Messages, so they at least match up roughly with my custom HTML equivalents.
    – Nate Beaty
    May 21, 2023 at 20:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.