Re: Re: Function to retrieve headers for message/rfc822 attachments
| From: | Brad Fisher | Date: | Thu, 28 Feb 2002 00:50:02 +0000 |
| Subject: | Re: Re: Function to retrieve headers for message/rfc822 attachments | ||
| References: | 1 2 3 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-80484@lists.php.net to get a copy of this message | ||
OK, did a little digging and it seems that it is not (necessarily) PHP that
doesn't support the x.HEADER/x.TEXT syntax... The c-client function called
by imap_fetchbody function calls mail_fetchbody_full (alias for
mail_fetch_body) which _does not_ support the above syntax since it only
expects integers in the section specification. The x.0 syntax for
retrieving the header is supported through a special check (read 'hack') in
mail_fetch_body, and appears as though it only exists for BC. In fact, that
special case calls mail_fetch_header the same as the funtion I posted does.
However, if you wanted c-client/IMAP to filter the header fields returned to
you (ie. you only want From and To headers), you cannot do that with
imap_fetchbody, even though mail_fetch_header supports it. To do that with
the new function you could do the following:
$headers = imap_fetch_header($mbox, 1, '2', Array('To', 'From'),
FT_PEEK);
Anyway, I have attached an updated diff with a couple of minor modifications
like c-style comments, tab indenting. If anyone thinks this is work
committing, feel free.
-Brad
Markus Fischer wrote:
> On Wed, Feb 27, 2002 at 12:16:47PM +0900, Yasuo Ohgaki wrote :
> > Brad Fisher wrote:
> > >This is a function I wrote a while back so I could access more of the
> > >headers available in a mail message. The imap_headers and
> > >imap_fetchheaders functions work fine for retrieving headers for the
> > >main body of a given message, but if you receive an email with an
> > >attachment which is itself an email message (ie. mime type
> > >'message/rfc822'), you can use this function to retrieve the (raw)
> >
> >
> > Could you post unified diff against latest CVS? (HEAD branch)
>
> "I don't think it is the c-Client lib that is broken here,
> but the PHP implementation."
>
> If that's true and someone can actually verify this I wold
> not hesitate and commit this but first fix the extension if
> the c-client library really supports it already.
>
> --
> Please always Cc to me when replying to me on the lists.
> GnuPG Key: http://guru.josefine.at/~mfischer/C2272BD0.asc