Send HTML email from my module I have a problem while sending a HTML email through my module, Here is my code below:

.install file

function invite_an_user_enable() {
  $current = variable_get('mail_system', array('default-system' =&gt; 'DefaultMailSystem'));
  $addition = array('invite_an_user' =&gt; 'invite_an_userMailSystem');
  variable_set('mail_system', array_merge($current, $addition));
}

function invite_an_user_disable() {
  $mail_system = variable_get('mail_system', array('default-system' =&gt; 'DefaultMailSystem'));
  unset($mail_system['invite_an_user']);
  variable_set('mail_system', $mail_system);
}


and here is the .module file:   

class invite_an_userMailSystem extends DefaultMailSystem {
  public function format(array $message) {
    $message['body'] = implode("\n\n", $message['body']);
    $message['body'] = drupal_wrap_mail($message['body']);
    return $message;
  }
}


Here is the email that I got:

&lt;p&gt;Hi &lt;strong&gt;myemail@email.com&lt;/strong&gt;,&amp;nbsp;&lt;/p&gt;

&lt;p&gt;Your friend &lt;strong&gt;another_email@email.com&lt;/strong&gt;, invited you in &lt;strong&gt;My Site Name&lt;/strong&gt;. Please cleck on the link to accept the invitation below:&lt;/p&gt;

&lt;p&gt;http://something.com/referral/3139323e&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;p&gt;Thanks,&lt;br /&gt;
My Site&lt;/p&gt;


Now the problem is that, when I received the email I can see all the tags in my email. And the header of the email is 

MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed; delsp=yes
Content-Transfer-Encoding: 8Bit
X-Mailer: Drupal


I believe this should be text/html rather than text/plain.
Am I doing something wrong? Is there any different method to send HTML mail? Feel free to ask any questions.
Solved that.
I added a line on my code i.e $message['headers']['Content-Type'] = 'text/html; charset=UTF-8;'

class invite_an_userMailSystem extends DefaultMailSystem {
  public function format(array $message) {
    $message['headers']['Content-Type'] = 'text/html; charset=UTF-8;';
    $message['body'] = implode("\n\n", $message['body']);
    $message['body'] = drupal_wrap_mail($message['body']);
    return $message;
  }
}


This is now working for me.. Yeppi :)