问题
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