drupal_mail() in HTML I want the outgoing mail that is sent by my custom module to be in HTML, but I dont know how.

This is my submit function:

//create an array from the companies in the db in a comma separated list
$companies = db_query("SELECT companies FROM {offer} WHERE id = $id")-&gt;fetchField();
$companies = explode(',', $companies);

// Set some variables
$from = 'noreply@danielholm.se';
$subject = 'Sent mail';
$module = 'mymodule';
$key = 'mykey';
$language = language_default();
$params = array();
$send = TRUE;

// the data
$question = db_query("SELECT message FROM {offer} WHERE id = $id")-&gt;fetchField();
$name = db_query("SELECT name FROM {offer} WHERE id = $id")-&gt;fetchField();
$mail = db_query("SELECT mail FROM {offer} WHERE id = $id")-&gt;fetchField();
$phone = db_query("SELECT phone FROM {offer} WHERE id = $id")-&gt;fetchField();
$compname = db_query("SELECT compname FROM {offer} WHERE id = $id")-&gt;fetchField();
$comptype = db_query("SELECT comptype FROM {offer} WHERE id = $id")-&gt;fetchField();

// Sort the companies
foreach($companies as $company) {
        $message = drupal_mail($module, $key, $company, $language, $params, $from, $send);
        // Create the mail content
        $message['subject'] = $subject;
        $message['body'] = array();
$message['body'][] = 'THe HTML MAIL HERE';

        // Retrieve the responsible implementation for this message.
        $system = drupal_mail_system($module, $key);

        // Format the message body.
        $message = $system-&gt;format($message);

        // Send e-mail.
        $message['result'] = $system-&gt;mail($message);

        // Update table where sent to 1
        $update = db_update('offer')
            -&gt;fields(array(
            'sent' =&gt; '1',
            ))
            -&gt;condition('id', $id, '=')
            -&gt;execute();

        // Set message of performed action
        drupal_set_message('Done');
        $form_state['redirect'] = 'admin/content/offer';
        cache_clear_all();
}
You can try Mime Mail module.


  This is a Mime Mail component module (for use by other modules).
  
  
  It permits users to recieve HTML email and can be used by other modules. The mail functionality accepts an HTML message body, mime-endcodes it and sends it.  
  If the HTML has embedded graphics, these graphics are MIME-encoded and included as a message attachment.
  Adopts your site's style by automatically including your theme's stylesheet files in a themeable HTML message format
  If the recipient's preference is available and they prefer plaintext, the HTML will be converted to plain text and sent as-is. Otherwise, the email will be sent in themeable HTML with a plaintext alternative.
  Allows you to theme messages with a specific mailkey.
  Converts CSS styles into inline style attributes.
  Provides simple system actions and Rules actions to send HTML email with embedded images and attachments.