+ /** return body in plain text (useful for messages without a text/plain part)
+ */
+ function get_body()
+ {
+ preg_match("@text/([^;]+);@", $this->headers['content-type'], $format);
+ if ($format[1] == 'plain') {
+ return $this->body;
+ }
+ $res = preg_replace("@<br[^>]>@", "@@@#@", $this->body);
+ $res = trim(html_entity_decode(strip_tags($res)));
+ $res = str_replace("@@@#@", "\n", $res);
+ if (!is_utf8($res)) {
+ $res = utf8_encode($res);
+ }
+ return $res;
+ }
+