I am using following function to convert HTML to plain text: function stripHTML($text) { // lists $text = preg_replace("/<li>/i", "* ", $text); $text = preg_replace("/<\/li>/i", "\r\n", $text); // tables $text = preg_replace("/<\/td>/i", "\t", $text); $text = preg_replace("/<\/th>/i", "\t", $text); $text = preg_replace("/<\/tr>/i", "\r\n", $text); // linebreaks $text = preg_replace("/<br[^>]+>|<br>/i", "\r\n", $text); $text = preg_replace("/<\/p>/i", "\r\n\r\n", $text); $text = preg_replace("/<\/div>/i", "\r\n", $text); // strip rest $text = strip_tags($text);
while (strpos($text, "\r\n\r\n\r\n") !== false) { $text = str_replace("\r\n\r\n\r\n", "\r\n\r\n", $text); } return trim($text); } Don't know whether it is a good way to convert HTML to text, but it works :-) -- Jan -------- Original-Nachricht -------- > Datum: Mon, 14 Dec 2009 15:42:57 +0100 > Von: "Саша Стаменковић" <umpir...@gmail.com> > An: takeshin <admi...@gmail.com> > CC: fw-general@lists.zend.com > Betreff: Re: [fw-general] Good HTML to plain ASCII class > You want to have html email templates and use them to set text body? > > I'm interested in this as well. And also for best practices on how to > build > powerful mailer with Zend_View and Zend_Layout. > > Regards, > Saša Stamenković > > > On Mon, Dec 14, 2009 at 3:35 PM, takeshin <admi...@gmail.com> wrote: > > > > > Can you recommend valuable HTML to plain ASCII class, > > for use with Zend_Mail::setBodyHtml and Zend_Mail::setBodyText ? > > > > -- > > regards > > takeshin > > -- > > View this message in context: > > http://n4.nabble.com/Good-HTML-to-plain-ASCII-class-tp963569p963569.html > > Sent from the Zend Framework mailing list archive at Nabble.com. > > -- Preisknaller: GMX DSL Flatrate für nur 16,99 Euro/mtl.! http://portal.gmx.net/de/go/dsl02