Php convert html to plain text for e-mail.

Asked By 10 points N/A Posted on -
qa-featured

 

Hi guys,

 

I have HTML files that need to be converted to plain text for email. Can someone help me, how  PHP convert HTML to plain text for e-mail?

Thanks.

Jim Bbauman

 

SHARE
Best Answer by Malone Toby
Best Answer
Best Answer
Answered By 0 points N/A #167241

Php convert html to plain text for e-mail.

qa-featured

Hello Jim,

The best solution for your question is to use TinyMCE. That allows you to convert html files to plain text. Another solution is to use a class called html2text. This answer should help you, I think that both of this programs works perfect. My friend had similar problems converting files and he used this programs, they helped him for sure.

Answered By 0 points N/A #167242

Php convert html to plain text for e-mail.

qa-featured

Hi Jim,

You could try html2text script which is licensed under the Eclipse Public License (which can be used commercially).

Usually it uses PHP's DOM methods to load them from HTML, and iterates over the resulting DOM to output plain text which can be used in email. You can use like the following:

$text =convert_html_to_text($html);

 

Related Questions