I am trying to write a class which would read out the body of a MIME message. I do not have problems with TEXT/PLAIN message as the imap_fetchbody(xx,xx,1) does the job perfictly or I could even use imap_body function.
When it comes to more complex Mails, I have trouble. I have not found any good idea on that this why I ask.
This post will be long but do not quit yet! I just want to demonstrate what I don't know
Here is a mail:
Code: Select all
stdClass Object
(
[type] => 1
[encoding] => 0
[ifsubtype] => 1
[subtype] => MIXED
[ifdescription] => 0
[ifid] => 0
[ifdisposition] => 0
[ifdparameters] => 0
[ifparameters] => 1
[parameters] => Array
(
[0] => stdClass Object
(
[attribute] => BOUNDARY
[value] => ----=_Part_17079_14032152.1212257923471
)
)
[parts] => Array
(
[0] => stdClass Object
(
[type] => 1
[encoding] => 0
[ifsubtype] => 1
[subtype] => ALTERNATIVE
[ifdescription] => 0
[ifid] => 0
[ifdisposition] => 0
[ifdparameters] => 0
[ifparameters] => 1
[parameters] => Array
(
[0] => stdClass Object
(
[attribute] => BOUNDARY
[value] => ----=_Part_17080_27976225.1212257923471
)
)
[parts] => Array
(
[0] => stdClass Object
(
[type] => 0
[encoding] => 4
[ifsubtype] => 1
[subtype] => PLAIN
[ifdescription] => 0
[ifid] => 0
[lines] => 27
[bytes] => 1316
[ifdisposition] => 1
[disposition] => INLINE
[ifdparameters] => 0
[ifparameters] => 1
[parameters] => Array
(
[0] => stdClass Object
(
[attribute] => CHARSET
[value] => ISO-8859-1
)
)
)
[1] => stdClass Object
(
[type] => 0
[encoding] => 4
[ifsubtype] => 1
[subtype] => HTML
[ifdescription] => 0
[ifid] => 0
[lines] => 61
[bytes] => 3025
[ifdisposition] => 1
[disposition] => INLINE
[ifdparameters] => 0
[ifparameters] => 1
[parameters] => Array
(
[0] => stdClass Object
(
[attribute] => CHARSET
[value] => ISO-8859-1
)
)
)
)
)
[1] => stdClass Object
(
[type] => 3
[encoding] => 3
[ifsubtype] => 1
[subtype] => VND.MS-POWERPOINT
[ifdescription] => 0
[ifid] => 0
[bytes] => 1151595
[ifdisposition] => 1
[disposition] => ATTACHMENT
[ifdparameters] => 1
[dparameters] => Array
(
[0] => stdClass Object
(
[attribute] => FILENAME
[value] => Fleming.ppt
)
)
[ifparameters] => 1
[parameters] => Array
(
[0] => stdClass Object
(
[attribute] => NAME
[value] => Fleming.ppt
)
)
)
[2] => stdClass Object
(
[type] => 0
[encoding] => 3
[ifsubtype] => 1
[subtype] => PLAIN
[ifdescription] => 0
[ifid] => 0
[lines] => 37
[bytes] => 1839
[ifdisposition] => 1
[disposition] => ATTACHMENT
[ifdparameters] => 1
[dparameters] => Array
(
[0] => stdClass Object
(
[attribute] => FILENAME
[value] => disclaimer.txt
)
)
[ifparameters] => 1
[parameters] => Array
(
[0] => stdClass Object
(
[attribute] => NAME
[value] => disclaimer.txt
)
)
)
)
)
This is a MULTIPART/MIXED mail. Is the text, the body entity of the mail, always the 1st one? How do I determine the "part_number" for imap_fetchbody() ?
To know, or not to know, that is the Question:
Because 'tis Number is the reason for suffer ...
Thanx a lot