开发者

how to force for "Text Only" email format while fetching them from gmail server using POP3 protocol?

Hi I am using Zend_Mail pop3 client to fetch emails from gmail account problem is t开发者_高级运维he content which I get is in HTML format but I want to store only text format . There are to solution I am looking forward to

a) force my pop3 client to retrieve only text message b) conver html into simple text i.e remove all the html tags properly .

Thanks.


An email is either in one specific format, or its in "multipart". In every case you must download the whole email. After it, you may either retrieve the text-part (if its multipart or text), or you must parse the html-source (or just strip_tags), if its html-only.

Zend_Mail_Part::getPart()


Whether mail is html or test is decided by the sender, not the recipient. Sometimes mail will be "multipart" where there is both a text and html version and you can choose to view either, but basically, you get what you get. Zend is PHP and allows plugins, so you might make use of a PHP html-to-text converter. I've seen some code on the web.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜