Internet media type returned by imap_fetchstructure

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
impulse()
Forum Regular
Posts: 748
Joined: Wed Aug 09, 2006 8:36 am
Location: Staffordshire, UK
Contact:

Internet media type returned by imap_fetchstructure

Post 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,
User avatar
andym01480
Forum Contributor
Posts: 390
Joined: Wed Apr 19, 2006 5:01 pm

Post 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
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post 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.
impulse()
Forum Regular
Posts: 748
Joined: Wed Aug 09, 2006 8:36 am
Location: Staffordshire, UK
Contact:

Post by impulse() »

How else would it be possible to determine the data type?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

impulse()
Forum Regular
Posts: 748
Joined: Wed Aug 09, 2006 8:36 am
Location: Staffordshire, UK
Contact:

Post 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,
Post Reply