PHP Doku:: Email-Kopfzeilen aus einem String auslesen - function.imap-rfc822-parse-headers.html

Verlauf / Chronik / History: (1) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzE-Mail-relevante ErweiterungenIMAP, POP3 and NNTPIMAP Funktionenimap_rfc822_parse_headers

Ein Service von Reinhard Neidl - Webprogrammierung.

IMAP Funktionen

<<imap_rfc822_parse_adrlist

imap_rfc822_write_address>>

imap_rfc822_parse_headers

(PHP 4, PHP 5)

imap_rfc822_parse_headersEmail-Kopfzeilen aus einem String auslesen

Beschreibung

object imap_rfc822_parse_headers ( string $headers [, string $defaulthost = "UNKNOWN" ] )

Liefert ein Objekt mit diversen Kopfelementen, ähnlich imap_header().

Parameter-Liste

headers

Die auszulesenden Kopfdaten

defaulthost

Der Default-Hostname

Rückgabewerte

Liefert ein ähnliches Objekt wie imap_header() mit Ausnahme der Flags und anderen vom IMAP Server gelieferten Daten.

Siehe auch


6 BenutzerBeiträge:
- Beiträge aktualisieren...
Marco Arment
23.07.2010 18:10
This function will cause a PHP Fatal Error if the text you're passing to it overflows a 16 KB buffer internally (SENDBUFLEN in the source).

I haven't looked into it in depth yet, but limiting the input text to less than 16,384 characters still produced this in one error case on our servers, but reducing the boundary to 12,000 fixed it.

Most real-world mail headers are well under 4 KB.
phrank
21.03.2009 23:10
This function is marked as internal function by the c-client library and should not be used by php directly.

Please be aware that the result will always contain fields that have not been set in the message. For example reply_to and sender will always be set even if there is no Reply-To and Sender header fields are defined in the message.
Oliver
16.04.2006 2:50
To see the content of the returned object try this code:

   $stream = imap_open($server, $username, $password);
   $header = imap_fetchheader($stream, $uid, FT_UID);
   $obj = imap_rfc822_parse_headers( $header);
   print "<html><head></head><body><pre>\n";
   print_r($obj);
   print "</pre></body></html>";
   imap_close($stream);
Kevin Casper
1.02.2005 19:23
I was lightly probing this function's behavoir.

It handles rfc882 fields:

date
subject
message_id
to
from
reply-to
sender         - will generate using 'from' field if not in
                     header
references
in-reply-to
cc

doesn't handle rfc882 fields:
return-path
received
resent-         I think this field may be obsolete
keywords     

If there are other rfc822 fields or behavoirs for the function, then I can't speak of them as they weren't in my test.
As it is relevent to what I'm currently doing I may add more about this function from time to time.
jh at junetz dot de
14.09.2004 17:22
But what you /will/ get is a complete To field, i.e. unfolded as specified for long header fields in RFC 822. So if you want to replace imap_headerinfo() by this function, you can run it on imap_fetchheader().
Sven dot Dickert at planb dot de
22.05.2002 1:28
The object you get from imap_rfc822_parse_headers differs from the object you get from imap_headerinfo/imap_header in the following points. You won't get the:
* flags
* msgno
* size
* Maildate
* udate
* fetchfrom
* fetchsubject

udate can be simulated with
$headerobj=imap_rfc822_parse_headers ($header);
$udate=strtotime($headerobj->date);



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)