Negin Nickparsa am Montag, 23. September 2013 - 20:59:
> I have read your mail twice and still I could not get what you want
> exactly.  

Sorry for my bad english! 
What I want is, that the users of my webmail client can see at a glance,
if mails in their mailboxes have attachments or not. (Thats a human
right! But of course I was joking... It's simply nice to provide this
information and should be done)

> but if you want to get the type of files fetch the structure and then
you
> can use disposition string, find the "attachment" and then return the
> array.

Yes, I could do even that! But this is worse! Imagine, you do this in
the overview of the mailbox content! This can be hunderds of mails! My
script paginates this stuff in blocks of 16 (or something) mail headers,
but even then you have an huge overhead.

Why? 
Because, first you must collect the sender and subject information. This
is done by "imap_fetch_overview()", parsing the mailheaders and grabing
some server data, like arrival date, size and flags.

Fine, but you still know nothing about attachments! You must do
something more. OK?

You whould run "imap_fetchstructure()", but sorry, that's the wrong time
and place. You will need this monster object only when the user _reads_
some specific mail. At the moment, we are not reading, but collecting
mails to present them in the mailbox overview.

My script modestly fetches the mailheaders again to read the
"Content-Type"-line. That's quite fast, works fine, but is stupid,
because this headers were fetched and parsed just before! 

I ask you, and all PHP developpers: Why the hell this function does not
parse this line too? (a part of so much others of less importance) The
same is true for "imap_headerinfo()". And: of course this
"Content-Type"-line provides by far not the complete MIME-structure as
"imap_fetchstructure()" does, but, as said, we don't need this at the
moment.

The result is a script, that I self whould not describe as "good
practice" because of it's duplicated parsing of the same string, but I
found no other way yet.

That's my problem, you see?

Sincerely
Niklaus

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to