X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FProtocol%2FEmail.php;h=00122e2eaeb3781b6463aaafb3c9b61815a3962f;hb=3bccaccede0c39b451e23bfdcdbdcadfd5368f53;hp=ee8c43eff8b77d8bce371eb1920127a148c70f54;hpb=e36f2bb1fb3439e9993c7568e57140c4f954b772;p=friendica.git diff --git a/src/Protocol/Email.php b/src/Protocol/Email.php index ee8c43eff8..00122e2eae 100644 --- a/src/Protocol/Email.php +++ b/src/Protocol/Email.php @@ -4,7 +4,8 @@ */ namespace Friendica\Protocol; -require_once 'include/html2plain.php'; +use Friendica\Content\Text\HTML; +use Friendica\Core\Protocol; /** * @brief Email class @@ -25,6 +26,16 @@ class Email $mbox = @imap_open($mailbox, $username, $password); + $errors = imap_errors(); + if (!empty($errors)) { + logger('IMAP Errors occured: ' . json_encode($errors)); + } + + $alerts = imap_alerts(); + if (!empty($alerts)) { + logger('IMAP Alerts occured: ' . json_encode($alerts)); + } + return $mbox; } @@ -111,7 +122,7 @@ class Email if (trim($ret['body']) == '') { $ret['body'] = self::messageGetPart($mbox, $uid, $struc, 0, 'plain'); } else { - $ret['body'] = html2bbcode($ret['body']); + $ret['body'] = HTML::toBBCode($ret['body']); } } else { $text = ''; @@ -128,7 +139,7 @@ class Email } } if (trim($html) != '') { - $ret['body'] = html2bbcode($html); + $ret['body'] = HTML::toBBCode($html); } else { $ret['body'] = $text; } @@ -298,7 +309,7 @@ class Email } /** - * Function send is used by NETWORK_EMAIL and NETWORK_EMAIL2 code + * Function send is used by Protocol::EMAIL and Protocol::EMAIL2 code * (not to notify the user, but to send items to email contacts) * * @param string $addr address @@ -328,7 +339,7 @@ class Email $body .= "Content-Transfer-Encoding: 8bit\n"; $body .= "Content-Type: text/plain; charset=utf-8; format=flowed\n\n"; - $body .= html2plain($html)."\n"; + $body .= HTML::toPlaintext($html)."\n"; $body .= "--=_".$part."\n"; $body .= "Content-Transfer-Encoding: 8bit\n"; @@ -617,12 +628,7 @@ class Email $currline = $arrbody[$i]; while ($previousquote < $quotelevel) { - if ($sender != '') { - $quote = "[quote title=$sender]"; - $sender = ''; - } else - $quote = "[quote]"; - + $quote = "[quote]"; $arrbody[$i] = $quote.$arrbody[$i]; $previousquote++; }