To fetch the particular section of the body of a message with imap_fetchbody()
, you have to pass the section
parameter which relates to the IMAP part number and is defined as follow in the PHP documentation:
It is a string of integers delimited by period which index into a body part list as per the IMAP4 specification
The only clue I have is to use imap_fetchstructure()
to read the structure of a particular message. However, I don't know how to deduce the part numbers from it.
EDIT
For those interested in the IMAPv4 specification, here is the paragraph about fetching where part numbers are mentioned. Unfortunately, it does not clearly state how to get or compute them.