Answers.Body: <p>We just fixed this yesterday with <a href="https://github.com/pixelandtonic/ContactForm/tree/1.8.1" rel="nofollow">Contact Form 1.8.1</a>.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-03T14:25:48.793Z
Answers.LastActivityDate: 2016-09-03T14:25:48.793Z
Answers.UserDisplayName: Brandon Kelly
Body: <p>I'm using the craft contact form plugin and I am trying to format the sent email as html. I have added the following to the primary contact form plugin class:</p>
  
  <pre><code>public function init()
      {
          craft()-&gt;on('contactForm.onBeforeMessageCompile', function(Event $event) {
              $postedMessage = $event-&gt;params['postedMessage'];
              $event-&gt;messageFields = $postedMessage;
  
              $html = '';
              foreach ($event-&gt;messageFields as $field) {
                  $html .= '&lt;p&gt;'.$field.'&lt;/p&gt;';
              }
  
              $event-&gt;message = $html;
              $event-&gt;htmlMessage = $html;
          });
      }
  </code></pre>
  
  <p>Simply to format into paragraphs. The event is fired ok and the desired output is being created. However the plugin service does not seem to be picking up the the htmlMessage variable has been set.</p>
  
  <p>Currently this sends the email as plain text showing the paragraphs in the text as per $event->message but even if I remove $event->message it still sends the default plain text message ignoring the html one has been set. Any ideas anyone?</p>
  
  <p>Cheers</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-09-03T15:02:03.833Z
Comments.Text: Per Brandon's answer, this is a bug.
Comments.UserDisplayName: Lindsey D
Tags: <plugin-contactform>
Title: Craft Contact Form Not Picking Up HTML
ThreadText: # Craft Contact Form Not Picking Up HTML
  
  (Asked by: username_0 on 2016-09-03)
  
  I'm using the craft contact form plugin and I am trying to format the sent email as html. I have added the following to the primary contact form plugin class:
  
  ```
  public function init()
      {
          craft()->on('contactForm.onBeforeMessageCompile', function(Event $event) {
              $postedMessage = $event->params['postedMessage'];
              $event->messageFields = $postedMessage;
  
              $html = '';
              foreach ($event->messageFields as $field) {
                  $html .= '<p>'.$field.'</p>';
              }
  
              $event->message = $html;
              $event->htmlMessage = $html;
          });
      }
  
  ```
  
  Simply to format into paragraphs. The event is fired ok and the desired output is being created. However the plugin service does not seem to be picking up the the htmlMessage variable has been set.
  
  Currently this sends the email as plain text showing the paragraphs in the text as per $event->message but even if I remove $event->message it still sends the default plain text message ignoring the html one has been set. Any ideas anyone?
  
  Cheers
  
  **Tags:** plugin-contactform
  
  > **Comments:**
  > **username_1**: Per username_2's answer, this is a bug.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2016-09-03. Score: 1
  
  We just fixed this yesterday with [Contact Form 1.8.1](https://github.com/pixelandtonic/ContactForm/tree/1.8.1).
  
  
  ---
  
  