Search code examples
phphtmlimap

php using imap_fetchbody my app on iis does not fetch html


I have a php web app that I am building a receive all function. I created the app on Dev environment on xampp and when I used imap_fetchbody using option 1.2 (HTML) it reads the HTML nicely. However I have now put the app into production on a windows server using iis- exactly the same code, however it will not get HTML content, it just shows blank. When I change to 1.1 (plain text) the body is fetched (but looks crap as there are no line breaks etc)


Solution

  • So for some reason when I use 2 as the email part instead of 1 it works. Strange that the same emails were in different parts for apache and iis.

    imap_fetchbody($mailbox, $emailNum, 2)
    

    the above works, I've actually done this:

    $body = (imap_fetchbody($mailbox,$emailNum,1.2))?imap_fetchbody($mailbox,$emailNum,1.2):imap_fetchbody($mailbox,$emailNum,2);