Answers.Body: <p>There currently isn't a native way to do what you're looking for, but you should consider voting for <a href="https://craftcms.uservoice.com/forums/285221-feature-requests/suggestions/12295260-there-were-separate-plain-text-and-html-inputs-for" rel="nofollow">this feature request</a> which would make it natively possible.</p>
  
  <p>As a workaround, you could write a plugin that listened to the <a href="https://craftcms.com/docs/plugins/events-reference#email-onBeforeSendEmail" rel="nofollow"><code>onBeforeSendEmail</code></a> event, checked to make sure it's the email you're looking for, then modify the <a href="https://craftcms.com/classreference/models/EmailModel#body-detail" rel="nofollow">body</a> property of the <a href="https://craftcms.com/classreference/models/EmailModel" rel="nofollow">EmailModel</a> however you wish.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-06T18:05:05.150Z
Answers.LastActivityDate: 2016-09-06T18:05:05.150Z
Answers.UserDisplayName: Brad Bell
Body: <p>I am adding a logo to the email message <code>When someone creates an account:</code> via <code>Settings &gt; Email &gt; Messages</code>, 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.</p>
  
  <p>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 <code>text/html</code> or <code>text/plain</code>?</p>
  
  <p>Desired usage:</p>
  
  <pre><code>{% 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 %}
  </code></pre>
  
  <p>For reference the message content is currently:</p>
  
  <pre><code>&lt;img src="http://www.example.org/admin/resources/rebrand/logo/logo.svg" width="200"&gt;
  
  Dear X,
  
  As a registered user...
  </code></pre>
  
  <p>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 <code>HTML Email Template</code> set within <code>Settings &gt; Email</code>.</p>
  
Tags: <conditional><admin><emails>
Title: Email Messages – If current email type is html or text
ThreadText: # Email Messages – If current email type is html or text
  
  (Asked by: username_0 on 2016-09-06)
  
  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`.
  
  **Tags:** conditional, admin, emails
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-09-06. Score: 2 | Accepted answer
  
  There currently isn't a native way to do what you're looking for, but you should consider voting for [this feature request](https://craftcms.uservoice.com/forums/285221-feature-requests/suggestions/12295260-there-were-separate-plain-text-and-html-inputs-for) which would make it natively possible.
  
  As a workaround, you could write a plugin that listened to the [`onBeforeSendEmail`](https://craftcms.com/docs/plugins/events-reference#email-onBeforeSendEmail) event, checked to make sure it's the email you're looking for, then modify the [body](https://craftcms.com/classreference/models/EmailModel#body-detail) property of the [EmailModel](https://craftcms.com/classreference/models/EmailModel) however you wish.
  
  
  ---
  
  