소스 검색

Fix for Outlook html mail with a defined background color and no text color.
When the default text color is white (that happens with some themes) then
you will see nothing. This fix set the text color to black.

stekkel 22 년 전
부모
커밋
06670a38a2
1개의 변경된 파일8개의 추가작업 그리고 0개의 파일을 삭제
  1. 8 0
      functions/mime.php

+ 8 - 0
functions/mime.php

@@ -1518,6 +1518,7 @@ function sq_body2div($attary, $mailbox, $message, $id){
     $divattary = Array('class' => "'bodyclass'");
     $bgcolor = '#ffffff';
     $text = '#000000';
+    $has_bgc_stl = $has_txt_stl = false;
     $styledef = '';
     if (is_array($attary) && sizeof($attary) > 0){
         foreach ($attary as $attname=>$attvalue){
@@ -1530,13 +1531,20 @@ function sq_body2div($attary, $mailbox, $message, $id){
                     $styledef .= "background-image: url('$attvalue'); ";
                     break;
                 case 'bgcolor':
+                    $has_bgc_stl = true;
                     $styledef .= "background-color: $attvalue; ";
                     break;
                 case 'text':
+                    $has_txt_stl = true;
                     $styledef .= "color: $attvalue; ";
                     break;
             }
         }
+        // Outlook defines a white bgcolor and no text color. This can lead to
+        // white text on a white bg with certain themes.
+        if ($has_bgc_stl && !$has_txt_stl) {
+            $styledef .= "color: $text; ";
+        }
         if (strlen($styledef) > 0){
             $divattary{"style"} = "\"$styledef\"";
         }