浏览代码

Better HTML email content style containment

pdontthink 5 年之前
父节点
当前提交
04a1ec1912
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      functions/mime.php

+ 3 - 1
functions/mime.php

@@ -2125,7 +2125,9 @@ function sq_fixstyle($body, $pos, $message, $id, $mailbox){
      * body {background: blah-blah}
      * body {background: blah-blah}
      * and change it to .bodyclass so we can just assign it to a <div>
      * and change it to .bodyclass so we can just assign it to a <div>
      */
      */
-    $content = preg_replace("|body(\s*\{.*?\})|si", ".bodyclass\\1", $content);
+    // Let's try out something that catches stuff like:  body, p, div {    or stuff like:  body a {
+    // $content = preg_replace("|body(\s*\{.*?\})|si", ".bodyclass\\1", $content);
+    $content = preg_replace("/body((?:\s*(?:,| )\s*[a-z0-9_-]+)*\s*\{.*?\})/si", ".bodyclass\\1", $content);
 
 
     global $use_transparent_security_image;
     global $use_transparent_security_image;
     if ($use_transparent_security_image) $secremoveimg = '../images/spacer.png';
     if ($use_transparent_security_image) $secremoveimg = '../images/spacer.png';