Page 1 of 1

Internet media type returned by imap_fetchstructure

Posted: Mon Aug 06, 2007 5:25 am
by impulse()
Hello.

When using imap_fetchbody to retrieve an e-mail message with a file attachment there is an array element named 'type' which I have come to believe is an internet media type. This is always represented by a number and I'm struggling to find any documentation as to what internet media type the numbers represent. Any help on this is appreciated.

Regards,

Posted: Mon Aug 06, 2007 5:48 am
by andym01480
It would seem the information you require is in the php manual!!! http://www.php.net/manual/en/function.i ... .php#43405. The poster has written a function that relates the numbers to types for attachments

Hope that helps

Posted: Mon Aug 06, 2007 5:49 am
by volka
http://de2.php.net/imap_fetchstructure wrote:Table 144. Primary body type
0 text
1 multipart
2 message
3 application
4 audio
5 image
6 video
7 other
The imap library doesn't test the actual data, it only parses the header data in the mail. Don't trust this value.

Posted: Mon Aug 06, 2007 5:53 am
by impulse()
How else would it be possible to determine the data type?

Posted: Mon Aug 06, 2007 6:07 am
by volka

Posted: Mon Aug 06, 2007 7:05 am
by impulse()
I'm not in the mood for installing extensions on Monday morning. I'm going to try out the 'file' command from a shell and see if I have any problems with that.

Thanks,