diff --git a/modules/mimemail_compress/mimemail_compress.inc b/modules/mimemail_compress/mimemail_compress.inc
index ebe5898..e7fb1b2 100644
--- a/modules/mimemail_compress/mimemail_compress.inc
+++ b/modules/mimemail_compress/mimemail_compress.inc
@@ -13,12 +13,14 @@
 function mimemail_compress_clean_message($message) {
   $parts = array();
   preg_match('|(<style[^>]+)>(.*)</style>|mis', $message, $matches);
-  $css = str_replace('<!--', '', $matches[2]);
-  $css = str_replace('-->', '', $css);
-  $css = preg_replace('|\{|', "\n{\n", $css);
-  $css = preg_replace('|\}|', "\n}\n", $css);
-  $html = str_replace($matches[0], '', $message);
-  $parts = array('html' => $html, 'css' => $css);
+  if (isset($matches[0]) && isset($matches[2])) {
+    $css = str_replace('<!--', '', $matches[2]);
+    $css = str_replace('-->', '', $css);
+    $css = preg_replace('|\{|', "\n{\n", $css);
+    $css = preg_replace('|\}|', "\n}\n", $css);
+    $html = str_replace($matches[0], '', $message);
+    $parts = array('html' => $html, 'css' => $css);
+  }
   return $parts;
 }
 
diff --git a/modules/mimemail_compress/mimemail_compress.module b/modules/mimemail_compress/mimemail_compress.module
index fdf0420..baeb22e 100644
--- a/modules/mimemail_compress/mimemail_compress.module
+++ b/modules/mimemail_compress/mimemail_compress.module
@@ -13,7 +13,9 @@ function mimemail_compress_mail_post_process(&$message, $mailkey) {
   // Separate CSS from HTML for processing
   $parts = mimemail_compress_clean_message($message);
   // Compress HTML and CSS into combined message
-  $output = new mimemail_compress($parts['html'], $parts['css']);
-  $output = $output->compress();
-  $message = $output;
+  if (!empty($parts)) {
+    $output = new mimemail_compress($parts['html'], $parts['css']);
+    $output = $output->compress();
+    $message = $output;
+  }
 }
diff --git a/theme/mimemail.theme.inc b/theme/mimemail.theme.inc
index 9f5485c..7285f51 100644
--- a/theme/mimemail.theme.inc
+++ b/theme/mimemail.theme.inc
@@ -84,36 +84,40 @@ function template_preprocess_mimemail_message(&$variables) {
     $styles = preg_replace($pattern, $replacement, drupal_get_css($css_files));
   }
 
-  // Process each style sheet.
   $css = '';
-  foreach (explode("\n", $styles) as $style) {
-    if (!empty($style) && @file_exists($style)) {
-      $css .= @file_get_contents($style);
+  if (isset($styles)) {
+    // Process each style sheet.
+    foreach (explode("\n", $styles) as $style) {
+      if (!empty($style) && @file_exists($style)) {
+        $css .= @file_get_contents($style);
+      }
     }
-  }
 
-  // Regexp to match comment blocks.
-  $comment     = '/\*[^*]*\*+(?:[^/*][^*]*\*+)*/';
-  // Regexp to match double quoted strings.
-  $double_quot = '"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"';
-  // Regexp to match single quoted strings.
-  $single_quot = "'[^'\\\\]*(?:\\\\.[^'\\\\]*)*'";
+    // Regexp to match comment blocks.
+    $comment = '/\*[^*]*\*+(?:[^/*][^*]*\*+)*/';
+    // Regexp to match double quoted strings.
+    $double_quot = '"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"';
+    // Regexp to match single quoted strings.
+    $single_quot = "'[^'\\\\]*(?:\\\\.[^'\\\\]*)*'";
 
-  // Perform some safe CSS optimizations (derived from core CSS aggregation).
-  $css = preg_replace_callback(
-    "<$double_quot|$single_quot|$comment>Sus",  // Match all comment blocks along
-    "_mimemail_process_comment",                // with double/single quoted strings
-    $css);                                      // and feed them to _mimemail_process_comment().
-  $css = preg_replace(
-    '<\s*([@{}:;,]|\)\s|\s\()\s*[^\n\S]>S',  // Remove whitespace around separators,
-    '\1',                                    // but keep space around parentheses
-    $css);                                   // and new lines between definitions.
+    // Perform some safe CSS optimizations (derived from core CSS aggregation).
+    $css = preg_replace_callback(
+      "<$double_quot|$single_quot|$comment>Sus",  // Match all comment blocks along
+      "_mimemail_process_comment",                // with double/single quoted strings
+      $css);                                      // and feed them to _mimemail_process_comment().
+    $css = preg_replace(
+      '<\s*([@{}:;,]|\)\s|\s\()\s*[^\n\S]>S',  // Remove whitespace around separators,
+      '\1',                                    // but keep space around parentheses
+      $css);                                   // and new lines between definitions.
 
-  // End the file with a new line.
-  $css .= "\n";
+    // End the file with a new line.
+    $css .= "\n";
+
+    // Wordwrap to adhere to RFC821
+    $css = wordwrap($css, 700);
+  }
 
-  // Wordwrap to adhere to RFC821
-  $css = wordwrap($css, 700);
+  // Set styles for the message.
   $variables['css'] = $css;
 
    // Process key to be a proper CSS class.
