I am adding a logo to the email message When someone creates an account: via Settings > Email > Messages, the image displays/renders correctly when viewed as "HTML / Rich Text" within mail clients, however; when the email is viewed as plain text, the html for the image is still output (as plain text) rather than being omitted.

Is it possible to conditionally render output from within the message depending on if the type of email content currently being parsed by Craft is for text/html or text/plain?

Desired usage:

{% if html %}
    This is the text/html part of the email message.
{% elseif plain %}
    This is the text/plain part of the email message.
{% endif %}

For reference the message content is currently:

<img src="http://www.example.org/admin/resources/rebrand/logo/logo.svg" width="200">

Dear X,

As a registered user...

Aside: This assumes that Craft processes the email message twice within the same process, once as plain and again as html. If this is not the case then this would likely be unachievable. I do not have an HTML Email Template set within Settings > Email.

1 Answer 1


There currently isn't a native way to do what you're looking for, but you should consider voting for this feature request which would make it natively possible.

As a workaround, you could write a plugin that listened to the onBeforeSendEmail event, checked to make sure it's the email you're looking for, then modify the body property of the EmailModel however you wish.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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