fmbiete / Z-Push-contrib

Z-Push fork with changes that I will try to contrib
GNU Affero General Public License v3.0
135 stars 62 forks source link

BodyPreference set to plain when HTML Available #201

Closed ghost closed 9 years ago

ghost commented 9 years ago

On my BB10 device I am getting plain-text CONVERTED bodies (basically HTML with the tags streipped) instead of HTML when the sender is a BlackBerry device -- which unless told otherwise will send ONLY HTML email (no plain text at all.)

I see where the conversion is happening as if "$plainBody" is null it gets converted, but I do not understand why $bpReturnType is SYNC_BODYPREFERENCE_PLAIN in that instance. Is this a function of a bad parameter being stored for the device somewhere?

I see where GetBodyPreferenceBestMatch should theoretically return HTML in preference to PLAIN, but it doesn't -- and as a result I get converted HTML if there is no plain text (which is invariably real ugly!)

In backend/imap/imap.php....

            $htmlBody = str_replace("\n","\r\n", str_replace("\r","",$htmlBody));
            $plainBody = str_replace("\n","\r\n", str_replace("\r","",$plainBody));
// KD 2015-06-11 If we have HTML in the main body, use it.
//
            if ($htmlbody !== "")
                $bpReturnType = SYNC_BODYPREFERENCE_HTML;

            if (Request::GetProtocolVersion() >= 12.0) {
                $output->asbody = new SyncBaseBody();
ghost commented 9 years ago

Scratch this I need to refactor it.. it breaks S/Mime