roundcube / roundcubemail

The Roundcube Webmail suite
https://roundcube.net
GNU General Public License v3.0
5.88k stars 1.64k forks source link

HTML rendering produces no output #7982

Closed Vitineth closed 3 years ago

Vitineth commented 3 years ago

Any HTML messages received currently do not display any output. Plain text versions of the emails are displayed correctly and the emails render correctly in rainloop (to try and make sure the email content wasn't completely invalid). This issue is shared by all HTML emails.

HTML Message Plain Text Rainloop Render
image image image

When opening the body in developer tools it shows this output in the iframe (however I'm not sure if I'm looking in the right place):

image

This is accessing an external IMAP server for mail if that makes a difference.

Server Information

Served via Apache2:

Server version: Apache/2.4.41 (Ubuntu)
Server built:   2020-08-12T19:46:17

Using PHP version 7.4 with the following extensions

$ php -r "print_r(get_loaded_extensions());"
(
    [0] => Core
    [1] => date
    [2] => libxml
    [3] => openssl
    [4] => pcre
    [5] => zlib
    [6] => filter
    [7] => hash
    [8] => pcntl
    [9] => Reflection
    [10] => SPL
    [11] => session
    [12] => standard
    [13] => sodium
    [14] => PDO
    [15] => xml
    [16] => calendar
    [17] => ctype
    [18] => curl
    [19] => dom
    [20] => mbstring
    [21] => FFI
    [22] => fileinfo
    [23] => ftp
    [24] => gd
    [25] => gettext
    [26] => iconv
    [27] => json
    [28] => exif
    [29] => pdo_pgsql
    [30] => pgsql
    [31] => Phar
    [32] => posix
    [33] => readline
    [34] => shmop
    [35] => SimpleXML
    [36] => sockets
    [37] => sysvmsg
    [38] => sysvsem
    [39] => sysvshm
    [40] => tokenizer
    [41] => xmlreader
    [42] => xmlwriter
    [43] => xsl
    [44] => Zend OPcache
)

The page is served behind a HAproxy reverse proxy server. The mail server is hosted via cpanel (I can get more information on it if needed). The page was accessed using Vivaldi 3.3.2022.45 (Stable channel) (64-bit) on Windows 10 OS Version 2009 (Build 19043.899) and the problem does continue to exist with all plugins disabled on Roundcubemail 1.4.11. I can attach the email if required but it is a standard mailchimp advertising email and the problem is shared by ever email I have received.

alecpl commented 3 years ago

Any HTML messages received currently

So it worked before? What changed? The HTML output is fishy. So, a sample will be needed. You could also enable imap_debug and verify that valid HTML is returned by the IMAP server.

Vitineth commented 3 years ago

Sorry I realise my phrasing was a bit misleading, I haven't had working support for HTML messages at all so far. This is how it has been acting since the install. To make it easier I've made the most simple email possible to show its not rendering.

Roundcube Render image

Rainloop Render image

Roundcube HTML image

Email Content (copied from the eml file exported via roundcube)


--_000_AS8PR06MB7351FB619E715420CAA0E3D9C87C9AS8PR06MB7351eurp_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

This is a test email containing bold and italics to ensure that it is sent =
as HTML and not plain text

--_000_AS8PR06MB7351FB619E715420CAA0E3D9C87C9AS8PR06MB7351eurp_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<html>
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Diso-8859-=
1">
<style type=3D"text/css" style=3D"display:none;"> P {margin-top:0;margin-bo=
ttom:0;} </style>
</head>
<body dir=3D"ltr">
<div style=3D"font-family: Calibri, Arial, Helvetica, sans-serif; font-size=
: 12pt; color: rgb(0, 0, 0);">
This is a test email containing <b>bold</b>&nbsp;and <i>italics</i>&nbsp;to=
 ensure that it is sent as HTML and not plain text</div>
</body>
</html>

--_000_AS8PR06MB7351FB619E715420CAA0E3D9C87C9AS8PR06MB7351eurp_--

(I can provide the complete .eml file if you would like)

I realise that this is likely an issue with my configuration but I am at a bit of a loss of what to change so apologies if this ends up being something obvious and completely my fault! I will enable imap_debug shortly and verify that it is receiving it correctly but I thought this would be a start.

alecpl commented 3 years ago

I have no clue. <!-- html ignored (?) --> is strange, Roundcube does not generate such code (I mean I don't see how that (?) is produced). Are there any errors in log? Does vendor/masterminds/html5 folder exist?

Could you add rcube::console($html); before and after this line https://github.com/roundcube/roundcubemail/blob/18b980cfb1d89ff0360272803ed93559b5f0f61f/program/steps/mail/func.inc#L906 ? This will log input and output from the HTML sanitizer. It's logged to logs/console.log. I'd like to see this log.

Vitineth commented 3 years ago

The errors.log file is empty currently and the old error file contains unrelated issues (a misconfigured plugin which is now resolved). The vendor/masterminds/html5 folder does exist and contains the following files:

$ la vendor/masterminds/html5
CREDITS  LICENSE.txt  README.md  RELEASE.md  UPGRADING.md  bin  composer.json  example.php  phpunit.xml.dist  sami.php  src

When the line is added to that file and the example email previously mentioned is opened, consosle.log contains the following

[12-Apr-2021 16:58:41 +0000]: <etr6d8s0> <!-- html ignored (?) --><!-- html ignored (?) --><!-- head ignored (?) --><!-- html ignored (?) --><!-- meta ignored (?) -->

<!-- html ignored (?) --><style type="text/css">P {margin-top:0;margin-bottom:0;} 

This is a test email containing bold and italics to ensure that it is sent as HTML and not plain text

</style>

This is the entire contents of the file. Thanks for looking into this, I really appreciate the assistance.

alecpl commented 3 years ago

Please, add rcube::console() after and BEFORE the "wash line".

Vitineth commented 3 years ago

I'm really sorry, I completely missed, that. Here is the console log with both logging messages:

[13-Apr-2021 12:28:47 +0000]: <u07vi33v> <html>
<head><meta charset="UTF-8" />

<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
This is a test email containing <b>bold</b>&nbsp;and <i>italics</i>&nbsp;to ensure that it is sent as HTML and not plain text</div>
</body>
</html>

[13-Apr-2021 12:28:48 +0000]: <u07vi33v> <!-- html ignored (?) --><!-- html ignored (?) --><!-- head ignored (?) --><!-- html ignored (?) --><!-- meta ignored (?) -->

<!-- html ignored (?) --><style type="text/css">P {margin-top:0;margin-bottom:0;} 

This is a test email containing bold and italics to ensure that it is sent as HTML and not plain text

</style>
alecpl commented 3 years ago

This is strange it two ways

What PHP version? Are you using opcache? Try without it.

You could also add rcube::console($html); before https://github.com/roundcube/roundcubemail/blob/18b980cfb1d89ff0360272803ed93559b5f0f61f/program/lib/Roundcube/rcube_washtml.php#L954

alecpl commented 3 years ago

No feedback. No way to reproduce.