What Niklaus wishes for is a way to detect if an email message contains an
attachment by just reading the headers (correct me if I am wrong).

This isn't really a PHP issue. In any language you can't really figure out
if an email has an attachment by just looking at the headers, you need to
check the body. You can try to infer by using the content-type or the size,
but that isn't 100% valid.

Aziz


On Mon, Sep 23, 2013 at 2:59 PM, Negin Nickparsa <nickpa...@gmail.com>wrote:

> I have read your mail twice and still I could not get what you want
> exactly.  can't get the structure of the email either although you
> elaborate it in details.
>
> you have said something about human rights that I couldn't understand why?
> 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.
>
>
>
>
> Sincerely
> Negin Nickparsa
>
>
> On Wed, Sep 18, 2013 at 3:27 PM, Domain nikha.org <m...@nikha.org> wrote:
>
> > Hello all,
> >
> > im posting this here, because the bug report system of "php.net" is not
> > right
> > place for my problem. It's not a bug, but a wish - an I found there no
> > "wishlist" option at all.
> >
> > I'm running my own webmail-client, written in PHP. It is stable, fast and
> > pretty, showing the full power of the PHP imap section.
> >
> > Of course it presents paginated content lists for every mailbox the user
> > may
> > open. These lists tell him some usefull things about every mail actually
> > listed:
> > Sender, date, subject, size and (eventually) flags.
> >
> > All these things are nicely delivered by the function
> > "imap_fetch_overview()"
> > The same could be done by calling "imap_headerinfo()" for every single
> > mail, but
> > "fetch_overview" seems to be faster, because it does it at once for the
> > whole
> > batch.
> >
> > BUT NONE OF THEM returns any information about the MIME-Type of the mail!
> >
> > Since the user of my webmail client has the intrinsic, natural born an
> > general
> > human right to KNOW whether some mail in his mailbox has attachments or
> > not, I'm
> > forced to do very ugly things. My script calls additionally for every (!)
> > actually listed mail  "imap_fetchbody($connect, $msg_no, 0)" - where
> > "$connect"
> > holds the result of "imap_open()".
> >
> > That gives me the mail header, the script reads the line starting with
> > "Content-Type:" and returns its content. Evaluating this against "mixed"
> or
> > "alternative" we have finaly what we want: This mail has attachments! Or
> is
> > written in HTML, what is even more we wanted!
> >
> > Works fine, but is ugly. First "fetch_overview" parses all mail headers,
> > then
> > they are fetched again to be parsed for the MIME-Type. I could just omit
> > "fetch_overview" and read the headers by my own means, that whould be
> > faster,
> > but then I loose the size information, that is NOT (and cannot) be part
> of
> > the
> > mail header!
> >
> > If I want to have both, size and MIME-Type, and I WANT to have both,
> > respecting
> > the intrinsic, natural born and general human rights of my user, im must
> > call
> > both, "overview" and "fetchbody".
> >
> > My question is this: Is there a better solution? Or is there someone that
> > knows
> > someone among the PHP-Developpers to suggest them an improvement of the
> > functions "imap_fetch_overivew()" and "imap_headerinfo()". Please,
> Please,
> > add
> > the MIME-Type to your fantastic object collections! BTW: It's really
> easy.
> > Read
> > the "Content-Type"-Line! Sorry...
> >
> > Hope, somebody has an idea,
> > my regards,
> >
> > Niklaus
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>

Reply via email to