Index: includes/mimemail.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mimemail/includes/mimemail.admin.inc,v
retrieving revision 1.1
diff -u -r1.1 mimemail.admin.inc
--- includes/mimemail.admin.inc	22 Feb 2009 20:55:46 -0000	1.1
+++ includes/mimemail.admin.inc	15 Jul 2010 12:23:47 -0000
@@ -54,6 +54,13 @@
     '#description'   => t('This option disables the use of email messages with graphics and styles.  All messages will be converted to plain text.'),
   );
 
+  $form['mimemail']['mimemail_embedimages'] = array(
+    '#type'          => 'checkbox',
+    '#title'         => t('Embed images in CSS'),
+    '#default_value' => variable_get('mimemail_embedimages', 0),
+    '#description'   => t('Use the <a href="@url">data URI scheme</a> to embed images (e.g. background-image) directly within CSS.', array('@url' => url('http://en.wikipedia.org/wiki/Data_URI_scheme'))),
+  );
+
   $form['mimemail']['incoming'] = array(
     '#type'          => 'fieldset',
     '#title'         => t('Advanced Settings'),
Index: theme/mimemail.theme.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mimemail/theme/mimemail.theme.inc,v
retrieving revision 1.5
diff -u -r1.5 mimemail.theme.inc
--- theme/mimemail.theme.inc	21 Apr 2010 23:26:42 -0000	1.5
+++ theme/mimemail.theme.inc	15 Jul 2010 12:23:47 -0000
@@ -15,6 +15,34 @@
 }
 
 /**
+ * Callback for preg_replace_callback().
+ */
+function _mimemail_expand_urls($matches) {
+  $theme = variable_get('theme_default', NULL);
+  $filename = drupal_get_path('theme', $theme) .'/'. trim($matches[1]);
+  $mimetype = file_get_mimetype($filename);
+  return _mimemail_data_uri($filename, $mimetype);
+}
+
+/**
+ * Helper function to encode data.
+ *
+ * @param $filename Path to the file.
+ * @param $mimetype MIME type of that file.
+ *
+ * @return The base64-encoded data as proper URI value.
+ */
+function _mimemail_data_uri($filename, $mimetype) {
+  if (@file_exists($filename)) {
+    $data = base64_encode(file_get_contents($filename));
+    return 'url(data:'. $mimetype .';base64,'. $data .')';
+  }
+  else {
+    return FALSE;
+  }
+}
+
+/**
  * A preprocess function for theme('mimemail_message').
  *
  * The $variables array initially contains the following arguments:
@@ -26,6 +54,9 @@
 function template_preprocess_mimemail_message(&$variables) {
   $theme = variable_get('theme_default', NULL);
 
+  // Check if site style sheets including is enabled.
+  $embedimages = variable_get('mimemail_embedimages', 0);
+
   // Check for the existence of a mail.css file in the current theme folder
   if (!file_exists($styles)) {
     $styles = drupal_get_path('theme', $theme) .'/mail.css';
@@ -43,6 +74,13 @@
     if (file_exists($style)) $css .= file_get_contents($style);
   }
 
+  // Embed images in CSS if enabled.
+  if ($embedimages) {
+    // Expand all URL and use data URI scheme.
+    $pattern = '/url\(\s*[\'"]*\s?([^\'"]+)?[\'"]?\s*?\)/iu';
+    $css = preg_replace_callback($pattern, '_mimemail_expand_urls', $css);
+  }
+
   // Perform some safe CSS optimizations. (derived from core CSS aggregation)
   $css = preg_replace('<
     \s*([@{}:;,]|\)\s|\s\()\s*[^\n\S] |  # Remove whitespace around separators, but keep space around parentheses and new lines between definitions.
