Jump to content

Imap_fetchbody question


ryy705

Recommended Posts

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

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

 

 

 

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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.