Retrieve html using imap_fetchbody

感情迁移 提交于 2019-12-11 06:16:52

问题


i am using imap to retrieve emails. It works fine for fine for plain text. But problem getting html, I use imap_fetchbody($connections,$email_number,1.2); but it does not work. It returns null. But if I try imap_fetchbody($connections,$email_number,1.1); which is for plain text I get * instead of html tag.

I appreciate any help


回答1:


As per PHP specifications

 string imap_fetchbody ( resource $imap_stream , int $msg_number , string $section [, int $options = 0 ] )

Just Remember that the number should be the string not the integer thus your command would be

 imap_fetchbody($connections,$email_number,"1.2");

Hope this would resolve your problem




回答2:


The html you are using, might be missing MIME type. You can give it a try using "<!DOCTYPE html> <html>" in starting of the mail content.



来源:https://stackoverflow.com/questions/14935303/retrieve-html-using-imap-fetchbody

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!