diff --git a/htmlmail.admin.inc b/htmlmail.admin.inc
index fcfea09..1c09e27 100644
--- a/htmlmail.admin.inc
+++ b/htmlmail.admin.inc
@@ -13,11 +13,34 @@ function htmlmail_admin_settings() {
   foreach (filter_formats() as $id => $filter) {
     $formats[$id] = $filter->name;
   }
-  $form['template'] = array(
+  $form['pre_filter'] = array(
     '#type' => 'fieldset',
     '#title' => t('Step 1'),
     '#collapsible' => FALSE,
   );
+  $form['pre_filter']['htmlmail_prefilter'] = array(
+    '#type' => 'select',
+    '#title' => t('Pre-filtering'),
+    '#default_value' => variable_get('htmlmail_prefilter', 0),
+    '#options' => $formats,
+    '#description' => t('You may choose an <a href="!formats">input format</a> to be used for filtering message body <em>before</em> theming.'),
+  );
+  $form['pre_filter']['htmlmail_body_untouched'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Keep message body untouched'),
+    '#default_value' => variable_get('htmlmail_body_untouched', 0),
+    '#description' => t('When filtering the message body, you may want to avoid the original body line breaks to be modified by HTML mail system.'),
+  );
+  $form['template'] = array(
+    '#type' => 'fieldset',
+    '#title' => '<h3>' . t('Step 2') . '</h3>',
+    '#collapsible' => FALSE,
+  );
+  $form['template'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Step 2'),
+    '#collapsible' => FALSE,
+  );
   $form['template']['htmlmail_template'] = array(
     '#type' => 'fieldset',
     '#prefix' => '<strong>' . t('Template file') . ':</strong><br />'
@@ -141,7 +164,7 @@ function htmlmail_admin_settings() {
   );
   $form['theme'] = array(
     '#type' => 'fieldset',
-    '#title' => t('Step 2'),
+    '#title' => t('Step 3'),
     '#collapsible' => FALSE,
   );
   $form['theme']['htmlmail_theme'] = array(
@@ -150,7 +173,7 @@ function htmlmail_admin_settings() {
     '#default_value' => variable_get('htmlmail_theme', ''),
     '#options' => htmlmail_get_allowed_themes(),
     '#suffix' => '<p>'
-    . t('Choose the theme that will hold your customized templates from Step 1 above.')
+    . t('Choose the theme that will hold your customized templates from Step 2 above.')
     . '</p><p>'
     . (module_exists('echo') ?
       t('The templated text will be styled by your chosen theme.  This lets you use any one of <a href="!themes">over 800</a> themes to style your messages.  Creating an email-specific sub-theme lets you use the full power of the <a href="!theme_system">drupal theme system</a> to format your messages.',
@@ -181,7 +204,7 @@ function htmlmail_admin_settings() {
   );
   $form['filter'] = array(
     '#type' => 'fieldset',
-    '#title' => t('Step 3'),
+    '#title' => t('Step 4'),
     '#collapsible' => FALSE,
   );
   $form['filter']['htmlmail_postfilter'] = array(
diff --git a/htmlmail.mail.inc b/htmlmail.mail.inc
index 16fe7cd..c2a9087 100644
--- a/htmlmail.mail.inc
+++ b/htmlmail.mail.inc
@@ -48,6 +48,7 @@ class HTMLMailSystem implements MailSystemInterface {
       if (is_array($message['body'])) {
         $message['body'] = implode("$eol$eol", $message['body']);
       }
+      $message['body'] = $this->preFilter($message['body']);
       $body = theme('htmlmail', $message);
       if ($message['body'] && !$body) {
         watchdog(
@@ -154,6 +155,7 @@ class HTMLMailSystem implements MailSystemInterface {
   public function formatMailMIME(array &$message) {
     $eol = variable_get('mail_line_endings', MAIL_LINE_ENDINGS);
     $message['body'] = MailMIME::concat($message['body']);
+    $message['body'] = $this->preFilter($message['body']);
     // Build a full email message string.
     $email = MailMIME::encodeEmail($message['headers'], $message['body']);
     // Parse it into MIME parts.
@@ -189,6 +191,21 @@ class HTMLMailSystem implements MailSystemInterface {
     $message['MailMIME'] = &$mime;
     return $body;
   }
+  
+  /**
+   * Applies pre-filtering to message body after concatenation it to
+   * single string.
+   * 
+   * @param string $body Message body
+   */
+  protected function preFilter($body) {
+    if ($format = variable_get('htmlmail_prefilter')) {
+      return check_markup($body, $format, FALSE);
+    }
+    else {
+      return $body;
+    }
+  }
 
   /**
    * Send an email message.
diff --git a/htmlmail.module b/htmlmail.module
index e8bbbde..12bd4ab 100644
--- a/htmlmail.module
+++ b/htmlmail.module
@@ -139,7 +139,7 @@ function htmlmail_mail($key, &$message, $params) {
   $message['module'] = 'htmlmail';
   $message['key'] = $key;
   $message['subject'] = $params['subject'];
-  $message['body'] = explode(
+  $message['body'] = variable_get('htmlmail_body_untouched') ? $params['body'] : explode(
     MAIL_LINE_ENDINGS . MAIL_LINE_ENDINGS,
     $params['body']
   );
