function send() { $html = p\Serverside::returnAgent($this->agent, $this->args, $this->lang); if (!isset($this->headers['Subject']) && preg_match("'<title[^>]*>(.*?)</title[^>]*>'isu", $html, $title)) { $this->headers['Subject'] = trim(html_entity_decode($title[1], ENT_COMPAT, 'UTF-8')); } // HTML cleanup // Remove noisy tags $html = preg_replace('#<(head|script|title|applet|frameset|i?frame)\\b[^>]*>.*?</\\1\\b[^>]*>#is', '', $html); $html = preg_replace('#</?(?:!doctype|html|meta|body|base|link)\\b[^>]*>#is', '', $html); $html = preg_replace('#<!--.*?-->#s', '', $html); $html = trim($html); // Clean up URLs in attributes $html = preg_replace_callback('/(\\s)(src|background|href)\\s*=\\s*(["\'])?((?(3).*?|[^\\s>]*))(?(3)\\3)/iu', array($this, 'cleanUrlAttribute'), $html); if (!empty($this->options['embedImages'])) { // Embed images $html = preg_replace_callback('/(\\s)(src|background)="([^"]+\\.(jpe?g|png|gif))"/iu', array($this, 'addRawImage'), $html); } $this->options['html'] =& $html; // HTML to text conversion $c = new converter_txt_html(78); $this->options['text'] = $c->convertData($html); parent::send(); }