public static function getTextVersion($template) { if (stristr($template, '<!-- //TEXT VERSION FOLLOWS//')) { $emailParts = explode('<!-- //TEXT VERSION FOLLOWS//', $template); $textVersion = array_pop($emailParts); $textVersion = trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\\/\\1>/s', '', $textVersion))); return $textVersion; } return false; }