ryy705 Posted September 8, 2008 Share Posted September 8, 2008 Hello, I am retrieving html out of a multipart message using: $html = imap_fetchbody($imapStream, $emailId, '2'); And I am retrieving plain text by using $plain = imap_fetchbody($imapStream, $emailId, '1'); My question is: Why is this working? I got this to work through trial and error. I don't know why I am using 1 or 2 as the third parameter. I looked up various examples online and they all use different values such as 2.1, 1.2, etc. I would like learn how to use this function properly so my script won't stop working one day. I thank you in advance for your help. Link to comment https://forums.phpfreaks.com/topic/123299-imap_fetchbody-question/ Share on other sites More sharing options...
ryy705 Posted September 9, 2008 Author Share Posted September 9, 2008 *bump* Link to comment https://forums.phpfreaks.com/topic/123299-imap_fetchbody-question/#findComment-637156 Share on other sites More sharing options...
ryy705 Posted September 9, 2008 Author Share Posted September 9, 2008 *bump* Link to comment https://forums.phpfreaks.com/topic/123299-imap_fetchbody-question/#findComment-637549 Share on other sites More sharing options...
BlueSkyIS Posted September 9, 2008 Share Posted September 9, 2008 I would like learn how to use this function properly so my script won't stop working one day. I thank you in advance for your help. have you tried looking at the manual? http://www.google.com/search?rls=en-us&q=php+imap_fetchbody&ie=UTF-8&oe=UTF-8 first result: http://www.php.net/imap_fetchbody Link to comment https://forums.phpfreaks.com/topic/123299-imap_fetchbody-question/#findComment-637556 Share on other sites More sharing options...
ryy705 Posted September 10, 2008 Author Share Posted September 10, 2008 Thank you for your reply. Yes I have googled it a lot. But take a look at Adam's post on http://theserverpages.com/php/manual/en/function.imap-fetchbody.php He lists the parts as following: 0 multipart/mixed 1 multipart/alternative 1.1 text/plain 1.2 text/html 2 message/rfc822 2 multipart/mixed 2.1 multipart/alternative 2.1.1 text/plain 2.1.2 text/html 2.2 message/rfc822 2.2 multipart/alternative 2.2.1 text/plain 2.2.2 text/html Also please take look at http://www.bitsense.net/PHPNotes/IMAP/imap_fetchstructure.asp/ On that page the parts are listed as ()Root Message Part (multipart/related) (1) The text parts of the message (multipart/alternative) (1.1) Plain text version (text/plain) (1.2) HTML version (text/html) (2) The background stationary (image/gif) If either one of these lists were correct, my script should fail. But so far it hasn't. So is my script working? Link to comment https://forums.phpfreaks.com/topic/123299-imap_fetchbody-question/#findComment-638544 Share on other sites More sharing options...
ryy705 Posted September 11, 2008 Author Share Posted September 11, 2008 *bump* Link to comment https://forums.phpfreaks.com/topic/123299-imap_fetchbody-question/#findComment-639027 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.