diff --git a/inc/DifferenceEngine.php b/inc/DifferenceEngine.php
index 6e1d07382a8aa7aef0d301200ca5db16cc32da26..52dca32c854c71ec7e1a68fd6c17e9ed09b10548 100644
--- a/inc/DifferenceEngine.php
+++ b/inc/DifferenceEngine.php
@@ -818,6 +818,39 @@ class DiffFormatter {
     }
 }
 
+/**
+ * Utilityclass for styling HTML formatted diffs
+ *
+ * Depends on global var $DIFF_INLINESTYLES, if true some minimal predefined
+ * inline styles are used. Useful for HTML mails and RSS feeds
+ *
+ * @author Andreas Gohr <andi@splitbrain.org>
+ */
+class HTMLDiff {
+    /**
+     * Holds the style names and basic CSS
+     */
+    static public $styles = array(
+            'diff-addedline'    => 'background-color: #ddffdd;',
+            'diff-deletedline'  => 'background-color: #ffdddd;',
+            'diff-context'      => 'background-color: #f5f5f5;',
+            'diff-mark'         => 'color: #ff0000;',
+        );
+
+    /**
+     * Return a class or style parameter
+     */
+    static function css($classname){
+        global $DIFF_INLINESTYLES;
+
+        if($DIFF_INLINESTYLES){
+            if(!isset(self::$styles[$classname])) return '';
+            return 'style="'.self::$styles[$classname].'"';
+        }else{
+            return 'class="'.$classname.'"';
+        }
+    }
+}
 
 /**
  *  Additions by Axel Boldt follow, partly taken from diff.php, phpwiki-1.3.3
@@ -838,11 +871,11 @@ class _HWLDF_WordAccumulator {
     function _flushGroup($new_tag) {
         if ($this->_group !== '') {
             if ($this->_tag == 'mark')
-                $this->_line .= '<strong>'.$this->_group.'</strong>';
+                $this->_line .= '<strong '.HTMLDiff::css('diff-mark').'>'.$this->_group.'</strong>';
             elseif ($this->_tag == 'add')
-                $this->_line .= '<span class="diff-addedline">'.$this->_group.'</span>';
+                $this->_line .= '<span '.HTMLDiff::css('diff-addedline').'>'.$this->_group.'</span>';
             elseif ($this->_tag == 'del')
-                $this->_line .= '<span class="diff-deletedline"><del>'.$this->_group.'</del></span>';
+                $this->_line .= '<span '.HTMLDiff::css('diff-deletedline').'><del>'.$this->_group.'</del></span>';
             else
                 $this->_line .= $this->_group;
         }
@@ -1020,8 +1053,8 @@ class TableDiffFormatter extends DiffFormatter {
         global $lang;
         $l1 = $lang['line'].' '.$xbeg;
         $l2 = $lang['line'].' '.$ybeg;
-        $r = '<tr><td class="diff-blockheader" colspan="2">'.$l1.":</td>\n".
-             '<td class="diff-blockheader" colspan="2">'.$l2.":</td>\n".
+        $r = '<tr><td '.HTMLDiff::css('diff-blockheader').' colspan="2">'.$l1.":</td>\n".
+             '<td '.HTMLDiff::css('diff-blockheader').' colspan="2">'.$l2.":</td>\n".
              "</tr>\n";
         return $r;
     }
@@ -1037,11 +1070,11 @@ class TableDiffFormatter extends DiffFormatter {
     }
 
     function addedLine($line) {
-        return '<td>+</td><td class="diff-addedline">' .  $line.'</td>';
+        return '<td>+</td><td '.HTMLDiff::css('diff-addedline').'>' .  $line.'</td>';
     }
 
     function deletedLine($line) {
-        return '<td>-</td><td class="diff-deletedline">' .  $line.'</td>';
+        return '<td>-</td><td '.HTMLDiff::css('diff-deletedline').'>' .  $line.'</td>';
     }
 
     function emptyLine() {
@@ -1049,7 +1082,7 @@ class TableDiffFormatter extends DiffFormatter {
     }
 
     function contextLine($line) {
-        return '<td> </td><td class="diff-context">'.$line.'</td>';
+        return '<td> </td><td '.HTMLDiff::css('diff-context').'>'.$line.'</td>';
     }
 
     function _added($lines) {
@@ -1115,9 +1148,9 @@ class InlineDiffFormatter extends DiffFormatter {
             $xbeg .= "," . $xlen;
         if ($ylen != 1)
             $ybeg .= "," . $ylen;
-        $r = '<tr><td colspan="'.$this->colspan.'" class="diff-blockheader">@@ '.$lang['line']." -$xbeg +$ybeg @@";
-        $r .= ' <span class="diff-deletedline"><del>'.$lang['deleted'].'</del></span>';
-        $r .= ' <span class="diff-addedline">'.$lang['created'].'</span>';
+        $r = '<tr><td colspan="'.$this->colspan.'" '.HTMLDiff::css('diff-blockheader').'>@@ '.$lang['line']." -$xbeg +$ybeg @@";
+        $r .= ' <span '.HTMLDiff::css('diff-deletedline').'><del>'.$lang['deleted'].'</del></span>';
+        $r .= ' <span '.HTMLDiff::css('diff-addedline').'>'.$lang['created'].'</span>';
         $r .= "</td></tr>\n";
         return $r;
     }
@@ -1134,19 +1167,19 @@ class InlineDiffFormatter extends DiffFormatter {
 
     function _added($lines) {
         foreach ($lines as $line) {
-            print('<tr><td colspan="'.$this->colspan.'" class="diff-addedline">'. $line . "</td></tr>\n");
+            print('<tr><td colspan="'.$this->colspan.'" '.HTMLDiff::css('diff-addedline').'>'. $line . "</td></tr>\n");
         }
     }
 
     function _deleted($lines) {
         foreach ($lines as $line) {
-            print('<tr><td colspan="'.$this->colspan.'" class="diff-deletedline"><del>' . $line . "</del></td></tr>\n");
+            print('<tr><td colspan="'.$this->colspan.'" '.HTMLDiff::css('diff-deletedline').'><del>' . $line . "</del></td></tr>\n");
         }
     }
 
     function _context($lines) {
         foreach ($lines as $line) {
-            print('<tr><td colspan="'.$this->colspan.'" class="diff-context">'.$line."</td></tr>\n");
+            print('<tr><td colspan="'.$this->colspan.'" '.HTMLDiff::css('diff-context').'>'.$line."</td></tr>\n");
         }
     }
 
diff --git a/inc/common.php b/inc/common.php
index a75d452a054f06c4cc6b1e08eb577d734ca5ea16..5e2bb7c9307778b217353395b4715eae7eb1021b 100644
--- a/inc/common.php
+++ b/inc/common.php
@@ -1086,6 +1086,7 @@ function notify($id,$who,$rev='',$summary='',$minor=false,$replace=array()){
     global $lang;
     global $conf;
     global $INFO;
+    global $DIFF_INLINESTYLES;
 
     // decide if there is something to do, eg. whom to mail
     if($who == 'admin'){
@@ -1131,8 +1132,11 @@ function notify($id,$who,$rev='',$summary='',$minor=false,$replace=array()){
                                     explode("\n",rawWiki($id)));
         $dformat         = new UnifiedDiffFormatter();
         $tdiff           = $dformat->format($df);
+
+        $DIFF_INLINESTYLES = true;
         $dformat         = new InlineDiffFormatter();
         $hdiff           = $dformat->format($df);
+        $DIFF_INLINESTYLES = false;
     }else{
         $subject         = $lang['mail_newpage'].' '.$id;
         $trep['OLDPAGE'] = '---';